[v5,3/3] Input: cap11xx - remove unnecessary IRQ parsing

Message ID 20231108155647.1812835-4-jiriv@axis.com
State New
Headers
Series Input: cap11xx add advanced sensitivity settings |

Commit Message

Jiri Valek - 2N Nov. 8, 2023, 3:56 p.m. UTC
  Separate IRQ parsing is not necessary, I2C core do the job.

Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
---
 drivers/input/keyboard/cap11xx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Comments

Rob Herring Nov. 8, 2023, 7:53 p.m. UTC | #1
On Wed, Nov 8, 2023 at 9:57 AM Jiri Valek - 2N <jiriv@axis.com> wrote:
>
> Separate IRQ parsing is not necessary, I2C core do the job.
>
> Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
> ---
>  drivers/input/keyboard/cap11xx.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> index 4711ea985627..ccca9936ef25 100644
> --- a/drivers/input/keyboard/cap11xx.c
> +++ b/drivers/input/keyboard/cap11xx.c
> @@ -518,7 +518,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
>         struct device *dev = &i2c_client->dev;
>         struct cap11xx_priv *priv;
>         const struct cap11xx_hw_model *cap;
> -       int i, error, irq;
> +       int i, error;
>         unsigned int val, rev;
>
>         if (id->driver_data >= ARRAY_SIZE(cap11xx_devices)) {
> @@ -624,13 +624,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
>         if (error)
>                 return error;
>
> -       irq = irq_of_parse_and_map(dev->of_node, 0);

Probably can drop the include of of_irq.h as well.
  
Jiri Valek - 2N Nov. 16, 2023, 7:43 a.m. UTC | #2
On 11/8/23 20:53, Rob Herring wrote:
> On Wed, Nov 8, 2023 at 9:57 AM Jiri Valek - 2N <jiriv@axis.com> wrote:
>>
>> Separate IRQ parsing is not necessary, I2C core do the job.
>>
>> Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
>> ---
>>  drivers/input/keyboard/cap11xx.c | 10 ++--------
>>  1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
>> index 4711ea985627..ccca9936ef25 100644
>> --- a/drivers/input/keyboard/cap11xx.c
>> +++ b/drivers/input/keyboard/cap11xx.c
>> @@ -518,7 +518,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
>>         struct device *dev = &i2c_client->dev;
>>         struct cap11xx_priv *priv;
>>         const struct cap11xx_hw_model *cap;
>> -       int i, error, irq;
>> +       int i, error;
>>         unsigned int val, rev;
>>
>>         if (id->driver_data >= ARRAY_SIZE(cap11xx_devices)) {
>> @@ -624,13 +624,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
>>         if (error)
>>                 return error;
>>
>> -       irq = irq_of_parse_and_map(dev->of_node, 0);
> 
> Probably can drop the include of of_irq.h as well.
Ack. Thanks for notice!
  
Dmitry Torokhov Nov. 17, 2023, 2:59 a.m. UTC | #3
On Thu, Nov 16, 2023 at 08:43:00AM +0100, Jiri Valek - 2N wrote:
> On 11/8/23 20:53, Rob Herring wrote:
> > On Wed, Nov 8, 2023 at 9:57 AM Jiri Valek - 2N <jiriv@axis.com> wrote:
> >>
> >> Separate IRQ parsing is not necessary, I2C core do the job.
> >>
> >> Signed-off-by: Jiri Valek - 2N <jiriv@axis.com>
> >> ---
> >>  drivers/input/keyboard/cap11xx.c | 10 ++--------
> >>  1 file changed, 2 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> >> index 4711ea985627..ccca9936ef25 100644
> >> --- a/drivers/input/keyboard/cap11xx.c
> >> +++ b/drivers/input/keyboard/cap11xx.c
> >> @@ -518,7 +518,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
> >>         struct device *dev = &i2c_client->dev;
> >>         struct cap11xx_priv *priv;
> >>         const struct cap11xx_hw_model *cap;
> >> -       int i, error, irq;
> >> +       int i, error;
> >>         unsigned int val, rev;
> >>
> >>         if (id->driver_data >= ARRAY_SIZE(cap11xx_devices)) {
> >> @@ -624,13 +624,7 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
> >>         if (error)
> >>                 return error;
> >>
> >> -       irq = irq_of_parse_and_map(dev->of_node, 0);
> > 
> > Probably can drop the include of of_irq.h as well.
> Ack. Thanks for notice!

I replaced it with #include <of.h> and applied, thank you.
  

Patch

diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 4711ea985627..ccca9936ef25 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -518,7 +518,7 @@  static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
 	struct device *dev = &i2c_client->dev;
 	struct cap11xx_priv *priv;
 	const struct cap11xx_hw_model *cap;
-	int i, error, irq;
+	int i, error;
 	unsigned int val, rev;
 
 	if (id->driver_data >= ARRAY_SIZE(cap11xx_devices)) {
@@ -624,13 +624,7 @@  static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
 	if (error)
 		return error;
 
-	irq = irq_of_parse_and_map(dev->of_node, 0);
-	if (!irq) {
-		dev_err(dev, "Unable to parse or map IRQ\n");
-		return -ENXIO;
-	}
-
-	error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
+	error = devm_request_threaded_irq(dev, i2c_client->irq, NULL, cap11xx_thread_func,
 					  IRQF_ONESHOT, dev_name(dev), priv);
 	if (error)
 		return error;