diff mbox series

[1/2] i2c: Remove unnecessary call to irq_find_mapping

Message ID 20181019085958.32694-1-ckeepax@opensource.cirrus.com
State Accepted
Headers show
Series [1/2] i2c: Remove unnecessary call to irq_find_mapping | expand

Commit Message

Charles Keepax Oct. 19, 2018, 8:59 a.m. UTC
irq_create_mapping calls irq_find_mapping internally and will use the
found mapping if one exists, so there is no need to manually call this
from i2c_smbus_host_notify_to_irq.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/i2c/i2c-core-base.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Wolfram Sang Oct. 28, 2018, 10:30 p.m. UTC | #1
On Fri, Oct 19, 2018 at 09:59:57AM +0100, Charles Keepax wrote:
> irq_create_mapping calls irq_find_mapping internally and will use the
> found mapping if one exists, so there is no need to manually call this
> from i2c_smbus_host_notify_to_irq.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Adding Benjamin to recipients. He wrote that code.

> ---
>  drivers/i2c/i2c-core-base.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index dc78aa7369def..656f0a6fe3adf 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -306,10 +306,7 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client)
>  	if (client->flags & I2C_CLIENT_TEN)
>  		return -EINVAL;
>  
> -	irq = irq_find_mapping(adap->host_notify_domain, client->addr);
> -	if (!irq)
> -		irq = irq_create_mapping(adap->host_notify_domain,
> -					 client->addr);
> +	irq = irq_create_mapping(adap->host_notify_domain, client->addr);
>  
>  	return irq > 0 ? irq : -ENXIO;
>  }
> -- 
> 2.11.0
>
Benjamin Tissoires Oct. 29, 2018, 10:13 a.m. UTC | #2
On Sun, Oct 28, 2018 at 11:30 PM Wolfram Sang <wsa@the-dreams.de> wrote:
>
> On Fri, Oct 19, 2018 at 09:59:57AM +0100, Charles Keepax wrote:
> > irq_create_mapping calls irq_find_mapping internally and will use the
> > found mapping if one exists, so there is no need to manually call this
> > from i2c_smbus_host_notify_to_irq.
> >
> > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
>
> Adding Benjamin to recipients. He wrote that code.

Yep, definitely looking good. For completeness, I just tested it on
the t450s, and it works fine.

This one is
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>
> > ---
> >  drivers/i2c/i2c-core-base.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> > index dc78aa7369def..656f0a6fe3adf 100644
> > --- a/drivers/i2c/i2c-core-base.c
> > +++ b/drivers/i2c/i2c-core-base.c
> > @@ -306,10 +306,7 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client)
> >       if (client->flags & I2C_CLIENT_TEN)
> >               return -EINVAL;
> >
> > -     irq = irq_find_mapping(adap->host_notify_domain, client->addr);
> > -     if (!irq)
> > -             irq = irq_create_mapping(adap->host_notify_domain,
> > -                                      client->addr);
> > +     irq = irq_create_mapping(adap->host_notify_domain, client->addr);
> >
> >       return irq > 0 ? irq : -ENXIO;
> >  }
> > --
> > 2.11.0
> >
Wolfram Sang Oct. 31, 2018, 11:34 p.m. UTC | #3
On Fri, Oct 19, 2018 at 09:59:57AM +0100, Charles Keepax wrote:
> irq_create_mapping calls irq_find_mapping internally and will use the
> found mapping if one exists, so there is no need to manually call this
> from i2c_smbus_host_notify_to_irq.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index dc78aa7369def..656f0a6fe3adf 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -306,10 +306,7 @@  static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client)
 	if (client->flags & I2C_CLIENT_TEN)
 		return -EINVAL;
 
-	irq = irq_find_mapping(adap->host_notify_domain, client->addr);
-	if (!irq)
-		irq = irq_create_mapping(adap->host_notify_domain,
-					 client->addr);
+	irq = irq_create_mapping(adap->host_notify_domain, client->addr);
 
 	return irq > 0 ? irq : -ENXIO;
 }