linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mike Looijmans
	<milo-software-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Kevin Hilman
	<khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>,
	Santosh Shilimkar
	<ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH v2 1/5] i2c: i2c-davinci: switch to use platform_get_irq
Date: Wed, 26 Nov 2014 16:54:31 +0100	[thread overview]
Message-ID: <20141126155431.GK4431@pengutronix.de> (raw)
In-Reply-To: <1417010393-30598-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>

Hello Grygorii,

On Wed, Nov 26, 2014 at 03:59:49PM +0200, Grygorii Strashko wrote:
> Switch Davinci I2C driver to use platform_get_irq(), because
> it is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ, ..)
> for requesting IRQ resources any more, as they can be not ready yet
> in case of DT-boot.
> 
> CC: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
> CC: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> CC: Santosh Shilimkar <ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> CC: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-davinci.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 4d96147..7f54903 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -640,13 +640,17 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>  {
>  	struct davinci_i2c_dev *dev;
>  	struct i2c_adapter *adap;
> -	struct resource *mem, *irq;
> -	int r;
> -
> -	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (!irq) {
> -		dev_err(&pdev->dev, "no irq resource?\n");
> -		return -ENODEV;
> +	struct resource *mem;
> +	int r, irq;
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq <= 0) {
> +		if (irq == -EPROBE_DEFER)
> +			return irq;
> +		if (!irq)
> +			irq = -ENXIO;
> +		dev_err(&pdev->dev, "can't get irq resource ret=%d\n", irq);
> +		return irq;
The simpler and I think also more usual logic is:

	if (!irq)
		irq = -ENXIO;
	if (irq != -EPROBE_DEFER)
		dev_err(...);
	return irq;

Other than that the patch looks fine.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  parent reply	other threads:[~2014-11-26 15:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 13:59 [PATCH v2 0/5] i2c: davinci improvements and fixes Grygorii Strashko
2014-11-26 13:59 ` [PATCH v2 1/5] i2c: i2c-davinci: switch to use platform_get_irq Grygorii Strashko
     [not found]   ` <1417010393-30598-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-26 15:54     ` Uwe Kleine-König [this message]
     [not found]       ` <20141126155431.GK4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-26 16:28         ` Grygorii Strashko
2014-11-26 13:59 ` [PATCH v2 2/5] i2c: davinci: query STP always when NACK is received Grygorii Strashko
     [not found]   ` <1417010393-30598-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-26 15:57     ` Uwe Kleine-König
2014-11-26 16:31       ` Grygorii Strashko
2014-11-26 17:15         ` Uwe Kleine-König
2014-11-26 13:59 ` [PATCH v2 3/5] i2c: recovery: change input parameter to i2c_adapter for prepare/unprepare_recovery Grygorii Strashko
2014-11-26 13:59 ` [PATCH v2 4/5] i2c: davinci: use bus recovery infrastructure Grygorii Strashko
     [not found]   ` <1417010393-30598-5-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-26 15:59     ` Uwe Kleine-König
2014-11-26 13:59 ` [PATCH v2 5/5] i2c: davinci: use ICPFUNC to toggle I2C as gpio for bus recovery Grygorii Strashko
     [not found]   ` <1417010393-30598-6-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-11-26 16:04     ` Uwe Kleine-König
     [not found]       ` <20141126160407.GN4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-26 17:05         ` Grygorii Strashko
     [not found]           ` <5476085B.40009-l0cyMroinI0@public.gmane.org>
2015-07-07 13:37             ` Jan Lübbe
     [not found]               ` <1436276269.3344.94.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-07-07 13:43                 ` Wolfram Sang
2015-07-07 13:48                 ` Uwe Kleine-König
     [not found]                   ` <20150707134852.GE9671-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-07-07 14:13                     ` Wolfram Sang
2015-07-07 14:53                       ` Grygorii Strashko

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=20141126155431.GK4431@pengutronix.de \
    --to=u.kleine-koenig-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
    --cc=khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m-karicheri2-l0cyMroinI0@public.gmane.org \
    --cc=milo-software-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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;
as well as URLs for NNTP newsgroup(s).