diff mbox

memory: omap-gpmc: use devm_gpiochip_add_data()

Message ID 1470643396-6795-1-git-send-email-linus.walleij@linaro.org
State New, archived
Headers show

Commit Message

Linus Walleij Aug. 8, 2016, 8:03 a.m. UTC
This saves a few codelines in the driver.

Cc: Roger Quadros <rogerq@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/memory/omap-gpmc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Roger Quadros Aug. 8, 2016, 8:33 a.m. UTC | #1
Hi Linus,

On 08/08/16 11:03, Linus Walleij wrote:
> This saves a few codelines in the driver.
> 
> Cc: Roger Quadros <rogerq@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Pushed to my -next queue. Thanks.

cheers,
-roger

> ---
>  drivers/memory/omap-gpmc.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 869c83fb3c5d..b2aea23ca0ae 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2266,7 +2266,7 @@ static int gpmc_gpio_init(struct gpmc_device *gpmc)
>  	gpmc->gpio_chip.get = gpmc_gpio_get;
>  	gpmc->gpio_chip.base = -1;
>  
> -	ret = gpiochip_add(&gpmc->gpio_chip);
> +	ret = devm_gpiochip_add_data(gpmv->dev, &gpmc->gpio_chip, NULL);
>  	if (ret < 0) {
>  		dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret);
>  		return ret;
> @@ -2275,11 +2275,6 @@ static int gpmc_gpio_init(struct gpmc_device *gpmc)
>  	return 0;
>  }
>  
> -static void gpmc_gpio_exit(struct gpmc_device *gpmc)
> -{
> -	gpiochip_remove(&gpmc->gpio_chip);
> -}
> -
>  static int gpmc_probe(struct platform_device *pdev)
>  {
>  	int rc;
> @@ -2394,7 +2389,6 @@ static int gpmc_remove(struct platform_device *pdev)
>  	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
>  
>  	gpmc_free_irq(gpmc);
> -	gpmc_gpio_exit(gpmc);
>  	gpmc_mem_exit();
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Aug. 8, 2016, 9:31 a.m. UTC | #2
Hi Linus,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc1 next-20160805]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Linus-Walleij/memory-omap-gpmc-use-devm_gpiochip_add_data/20160808-160509
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/memory/omap-gpmc.c: In function 'gpmc_gpio_init':
>> drivers/memory/omap-gpmc.c:2269:31: error: 'gpmv' undeclared (first use in this function)
     ret = devm_gpiochip_add_data(gpmv->dev, &gpmc->gpio_chip, NULL);
                                  ^
   drivers/memory/omap-gpmc.c:2269:31: note: each undeclared identifier is reported only once for each function it appears in
   drivers/memory/omap-gpmc.c: In function 'gpmc_probe':
>> drivers/memory/omap-gpmc.c:2378:2: error: implicit declaration of function 'gpmc_gpio_exit' [-Werror=implicit-function-declaration]
     gpmc_gpio_exit(gpmc);
     ^
   cc1: some warnings being treated as errors

vim +/gpmv +2269 drivers/memory/omap-gpmc.c

  2263		gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input;
  2264		gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output;
  2265		gpmc->gpio_chip.set = gpmc_gpio_set;
  2266		gpmc->gpio_chip.get = gpmc_gpio_get;
  2267		gpmc->gpio_chip.base = -1;
  2268	
> 2269		ret = devm_gpiochip_add_data(gpmv->dev, &gpmc->gpio_chip, NULL);
  2270		if (ret < 0) {
  2271			dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret);
  2272			return ret;
  2273		}
  2274	
  2275		return 0;
  2276	}
  2277	
  2278	static int gpmc_probe(struct platform_device *pdev)
  2279	{
  2280		int rc;
  2281		u32 l;
  2282		struct resource *res;
  2283		struct gpmc_device *gpmc;
  2284	
  2285		gpmc = devm_kzalloc(&pdev->dev, sizeof(*gpmc), GFP_KERNEL);
  2286		if (!gpmc)
  2287			return -ENOMEM;
  2288	
  2289		gpmc->dev = &pdev->dev;
  2290		platform_set_drvdata(pdev, gpmc);
  2291	
  2292		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  2293		if (res == NULL)
  2294			return -ENOENT;
  2295	
  2296		phys_base = res->start;
  2297		mem_size = resource_size(res);
  2298	
  2299		gpmc_base = devm_ioremap_resource(&pdev->dev, res);
  2300		if (IS_ERR(gpmc_base))
  2301			return PTR_ERR(gpmc_base);
  2302	
  2303		res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  2304		if (!res) {
  2305			dev_err(&pdev->dev, "Failed to get resource: irq\n");
  2306			return -ENOENT;
  2307		}
  2308	
  2309		gpmc->irq = res->start;
  2310	
  2311		gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
  2312		if (IS_ERR(gpmc_l3_clk)) {
  2313			dev_err(&pdev->dev, "Failed to get GPMC fck\n");
  2314			return PTR_ERR(gpmc_l3_clk);
  2315		}
  2316	
  2317		if (!clk_get_rate(gpmc_l3_clk)) {
  2318			dev_err(&pdev->dev, "Invalid GPMC fck clock rate\n");
  2319			return -EINVAL;
  2320		}
  2321	
  2322		if (pdev->dev.of_node) {
  2323			rc = gpmc_probe_dt(pdev);
  2324			if (rc)
  2325				return rc;
  2326		} else {
  2327			gpmc_cs_num = GPMC_CS_NUM;
  2328			gpmc_nr_waitpins = GPMC_NR_WAITPINS;
  2329		}
  2330	
  2331		pm_runtime_enable(&pdev->dev);
  2332		pm_runtime_get_sync(&pdev->dev);
  2333	
  2334		l = gpmc_read_reg(GPMC_REVISION);
  2335	
  2336		/*
  2337		 * FIXME: Once device-tree migration is complete the below flags
  2338		 * should be populated based upon the device-tree compatible
  2339		 * string. For now just use the IP revision. OMAP3+ devices have
  2340		 * the wr_access and wr_data_mux_bus register fields. OMAP4+
  2341		 * devices support the addr-addr-data multiplex protocol.
  2342		 *
  2343		 * GPMC IP revisions:
  2344		 * - OMAP24xx			= 2.0
  2345		 * - OMAP3xxx			= 5.0
  2346		 * - OMAP44xx/54xx/AM335x	= 6.0
  2347		 */
  2348		if (GPMC_REVISION_MAJOR(l) > 0x4)
  2349			gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS;
  2350		if (GPMC_REVISION_MAJOR(l) > 0x5)
  2351			gpmc_capability |= GPMC_HAS_MUX_AAD;
  2352		dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
  2353			 GPMC_REVISION_MINOR(l));
  2354	
  2355		gpmc_mem_init();
  2356		rc = gpmc_gpio_init(gpmc);
  2357		if (rc)
  2358			goto gpio_init_failed;
  2359	
  2360		gpmc->nirqs = GPMC_NR_NAND_IRQS + gpmc_nr_waitpins;
  2361		rc = gpmc_setup_irq(gpmc);
  2362		if (rc) {
  2363			dev_err(gpmc->dev, "gpmc_setup_irq failed\n");
  2364			goto setup_irq_failed;
  2365		}
  2366	
  2367		rc = gpmc_probe_dt_children(pdev);
  2368		if (rc < 0) {
  2369			dev_err(gpmc->dev, "failed to probe DT children\n");
  2370			goto dt_children_failed;
  2371		}
  2372	
  2373		return 0;
  2374	
  2375	dt_children_failed:
  2376		gpmc_free_irq(gpmc);
  2377	setup_irq_failed:
> 2378		gpmc_gpio_exit(gpmc);
  2379	gpio_init_failed:
  2380		gpmc_mem_exit();
  2381		pm_runtime_put_sync(&pdev->dev);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 869c83fb3c5d..b2aea23ca0ae 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2266,7 +2266,7 @@  static int gpmc_gpio_init(struct gpmc_device *gpmc)
 	gpmc->gpio_chip.get = gpmc_gpio_get;
 	gpmc->gpio_chip.base = -1;
 
-	ret = gpiochip_add(&gpmc->gpio_chip);
+	ret = devm_gpiochip_add_data(gpmv->dev, &gpmc->gpio_chip, NULL);
 	if (ret < 0) {
 		dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret);
 		return ret;
@@ -2275,11 +2275,6 @@  static int gpmc_gpio_init(struct gpmc_device *gpmc)
 	return 0;
 }
 
-static void gpmc_gpio_exit(struct gpmc_device *gpmc)
-{
-	gpiochip_remove(&gpmc->gpio_chip);
-}
-
 static int gpmc_probe(struct platform_device *pdev)
 {
 	int rc;
@@ -2394,7 +2389,6 @@  static int gpmc_remove(struct platform_device *pdev)
 	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
 
 	gpmc_free_irq(gpmc);
-	gpmc_gpio_exit(gpmc);
 	gpmc_mem_exit();
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);