mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 04/18] [RFC] base/driver.c: Remove dev_request_mem_region_err_null
Date: Tue, 16 Feb 2016 17:29:05 -0800	[thread overview]
Message-ID: <1455672559-25061-5-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1455672559-25061-1-git-send-email-andrew.smirnov@gmail.com>

Having functional IS_ERR on AT91 means we no longer need that function

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/mach-at91/at91sam926x_time.c |  6 +++---
 drivers/base/driver.c                 | 16 ----------------
 drivers/pinctrl/pinctrl-at91.c        |  6 +++---
 drivers/serial/atmel.c                |  6 +++---
 include/driver.h                      |  8 --------
 5 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index cc7ad2f..789e1ec 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)
 		return ret;
 	}
 
-	pit_base = dev_request_mem_region_err_null(dev, 0);
-	if (!pit_base)
-		return -ENOENT;
+	pit_base = dev_request_mem_region(dev, 0);
+	if (IS_ERR(pit_base))
+		return PTR_ERR(pit_base);
 
 	pit_rate = clk_get_rate(clk) / 16;
 
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 2ef7ca9..a3ca057 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -385,22 +385,6 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n
 }
 EXPORT_SYMBOL(dev_request_mem_region_by_name);
 
-void __iomem *dev_request_mem_region_err_null(struct device_d *dev, int num)
-{
-	struct resource *res;
-
-	res = dev_get_resource(dev, IORESOURCE_MEM, num);
-	if (IS_ERR(res))
-		return NULL;
-
-	res = request_iomem_region(dev_name(dev), res->start, res->end);
-	if (IS_ERR(res))
-		return NULL;
-
-	return IOMEM(res->start);
-}
-EXPORT_SYMBOL(dev_request_mem_region_err_null);
-
 void __iomem *dev_request_mem_region(struct device_d *dev, int num)
 {
 	struct resource *res;
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index ebbc6f6..816a3f3 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -652,9 +652,9 @@ static int at91_gpio_probe(struct device_d *dev)
 	}
 
 	gpio_banks = max(gpio_banks, alias_idx + 1);
-	at91_gpio->regbase = dev_request_mem_region_err_null(dev, 0);
-	if (!at91_gpio->regbase)
-		return -ENOENT;
+	at91_gpio->regbase = dev_request_mem_region(dev, 0);
+	if (IS_ERR(at91_gpio->regbase))
+		return PTR_ERR(at91_gpio->regbase);
 
 	at91_gpio->chip.ops = &at91_gpio_ops;
 	at91_gpio->chip.ngpio = MAX_NB_GPIO_PER_BANK;
diff --git a/drivers/serial/atmel.c b/drivers/serial/atmel.c
index 4e4624e..1f40692 100644
--- a/drivers/serial/atmel.c
+++ b/drivers/serial/atmel.c
@@ -398,9 +398,9 @@ static int atmel_serial_init_port(struct console_device *cdev)
 	struct device_d *dev = cdev->dev;
 	struct atmel_uart_port *uart = to_atmel_uart_port(cdev);
 
-	uart->base = dev_request_mem_region_err_null(dev, 0);
-	if (!uart->base)
-		return -ENOENT;
+	uart->base = dev_request_mem_region(dev, 0);
+	if (IS_ERR(uart->base))
+		return PTR_ERR(uart->base);
 
 	uart->clk = clk_get(dev, "usart");
 	clk_enable(uart->clk);
diff --git a/include/driver.h b/include/driver.h
index 31c6734..08adaf9 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -206,14 +206,6 @@ void *dev_get_mem_region(struct device_d *dev, int num);
  */
 void __iomem *dev_request_mem_region(struct device_d *dev, int num);
 
-/*
- * exlusively request register base 'num' for a device
- * will return NULL on error
- * only used on platform like at91 where the Ressource address collision with
- * PTR errno
- */
-void __iomem *dev_request_mem_region_err_null(struct device_d *dev, int num);
-
 struct device_d *device_alloc(const char *devname, int id);
 
 int device_add_resources(struct device_d *dev, const struct resource *res, int num);
-- 
2.5.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2016-02-17  1:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  1:29 [PATCH 00/17] RFC for additional 'nvmem' plumbing Andrey Smirnov
2016-02-17  1:29 ` [PATCH 01/18] common: Add EPROBE_DEFER to strerror Andrey Smirnov
2016-02-17  1:29 ` [PATCH 02/18] base: driver.c: Coalesce error checking code Andrey Smirnov
2016-02-17  1:29 ` [PATCH 03/18] [RFC] at91: Make IS_ERR work for I/O pointers Andrey Smirnov
2016-02-17  8:34   ` Sascha Hauer
2016-02-17 20:39     ` Andrey Smirnov
2016-02-18 10:26       ` Sascha Hauer
2016-02-17  1:29 ` Andrey Smirnov [this message]
2016-02-17  1:29 ` [PATCH 05/18] i2c-at91: Use IS_ERR instead of checking for NULL Andrey Smirnov
2016-02-17  1:29 ` [PATCH 06/18] clk-imx6: Call clk_enable on mmdc_ch0_axi_podf Andrey Smirnov
2016-02-17  1:29 ` [PATCH 07/18] fec_imx: Deallocate clocks when probe fails Andrey Smirnov
2016-02-17  1:29 ` [PATCH 08/18] [RFC] base: Introduce dev_request_mem_resource Andrey Smirnov
2016-02-17  1:29 ` [PATCH 09/18] fec_imx: Deallocate I/O resources if probe fails Andrey Smirnov
2016-02-17  1:29 ` [PATCH 10/18] fec_imx: Free phy_reset GPIO if when " Andrey Smirnov
2016-02-17  1:29 ` [PATCH 11/18] fec_imx: Use FEC_ECNTRL_RESET instead of a magic number Andrey Smirnov
2016-02-17  1:29 ` [PATCH 12/18] fec_imx: Impelemnt reset timeout Andrey Smirnov
2016-02-17  8:43   ` Sascha Hauer
2016-02-17  1:29 ` [PATCH 13/18] fec_imx: Deallocate DMA buffers when probe fails Andrey Smirnov
2016-02-17  1:29 ` [PATCH 14/18] fec_imx: Unregister MDIO " Andrey Smirnov
2016-02-17  1:29 ` [PATCH 15/18] [RFC] net: eth: Always use DEVICE_ID_DYNAMIC Andrey Smirnov
2016-02-17  2:40   ` Trent Piepho
2016-02-17  4:16     ` Andrey Smirnov
2016-02-18 19:30       ` Trent Piepho
2016-02-19 17:17         ` Andrey Smirnov
2016-02-17  1:29 ` [PATCH 16/18] [RFC] nvmem: Add of_nvmem_cell_from_cell_np Andrey Smirnov
2016-02-17  1:29 ` [PATCH 17/18] [RFC] nvmem: Add nvmem-ro-of-blob driver Andrey Smirnov
2016-02-17  8:52   ` Sascha Hauer
2016-02-17 20:40     ` Andrey Smirnov
2016-02-17  1:29 ` [PATCH 18/18] [RFC] nvmem: Add nvmem-sg driver Andrey Smirnov
2016-02-17  3:09 ` [PATCH 00/17] RFC for additional 'nvmem' plumbing Trent Piepho
2016-02-17  4:20   ` Andrey Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455672559-25061-5-git-send-email-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox