All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wilc1000: use wilc handler as cookie in request_threaded_irq()
@ 2021-02-24 12:21 Ajay.Kathat
  2021-02-24 15:28 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Ajay.Kathat @ 2021-02-24 12:21 UTC (permalink / raw)
  To: linux-wireless, kvalo; +Cc: Claudiu.Beznea, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Use same cookie for request_threaded_irq() & free_irq() to properly free
IRQ during module unload. free_irq() already uses *wilc* handler so the
changes are required for request_threaded_irq().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/net/wireless/microchip/wilc1000/netdev.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 1b205e7d97a8..66f725aad209 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -24,12 +24,10 @@
 
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
-	struct net_device *dev = user_data;
-	struct wilc_vif *vif = netdev_priv(dev);
-	struct wilc *wilc = vif->wilc;
+	struct wilc *wilc = (struct wilc *)user_data;
 
 	if (wilc->close) {
-		netdev_err(dev, "Can't handle UH interrupt\n");
+		pr_err("Can't handle UH interrupt");
 		return IRQ_HANDLED;
 	}
 	return IRQ_WAKE_THREAD;
@@ -37,12 +35,10 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
-	struct net_device *dev = userdata;
-	struct wilc_vif *vif = netdev_priv(userdata);
-	struct wilc *wilc = vif->wilc;
+	struct wilc *wilc = (struct wilc *)userdata;
 
 	if (wilc->close) {
-		netdev_err(dev, "Can't handle BH interrupt\n");
+		pr_err("Can't handle BH interrupt\n");
 		return IRQ_HANDLED;
 	}
 
@@ -60,7 +56,7 @@ static int init_irq(struct net_device *dev)
 	ret = request_threaded_irq(wl->dev_irq_num, isr_uh_routine,
 				   isr_bh_routine,
 				   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-				   "WILC_IRQ", dev);
+				   "WILC_IRQ", wl);
 	if (ret) {
 		netdev_err(dev, "Failed to request IRQ [%d]\n", ret);
 		return ret;
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wilc1000: use wilc handler as cookie in request_threaded_irq()
  2021-02-24 12:21 [PATCH] wilc1000: use wilc handler as cookie in request_threaded_irq() Ajay.Kathat
@ 2021-02-24 15:28 ` Kalle Valo
  2021-02-25  4:21   ` Ajay.Kathat
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2021-02-24 15:28 UTC (permalink / raw)
  To: Ajay.Kathat; +Cc: linux-wireless, Claudiu.Beznea

<Ajay.Kathat@microchip.com> writes:

> From: Ajay Singh <ajay.kathat@microchip.com>
>
> Use same cookie for request_threaded_irq() & free_irq() to properly free
> IRQ during module unload. free_irq() already uses *wilc* handler so the
> changes are required for request_threaded_irq().
>
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> ---
>  drivers/net/wireless/microchip/wilc1000/netdev.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
> index 1b205e7d97a8..66f725aad209 100644
> --- a/drivers/net/wireless/microchip/wilc1000/netdev.c
> +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
> @@ -24,12 +24,10 @@
>  
>  static irqreturn_t isr_uh_routine(int irq, void *user_data)
>  {
> -	struct net_device *dev = user_data;
> -	struct wilc_vif *vif = netdev_priv(dev);
> -	struct wilc *wilc = vif->wilc;
> +	struct wilc *wilc = (struct wilc *)user_data;

No need to cast a void pointer.

>  
>  	if (wilc->close) {
> -		netdev_err(dev, "Can't handle UH interrupt\n");
> +		pr_err("Can't handle UH interrupt");
>  		return IRQ_HANDLED;
>  	}
>  	return IRQ_WAKE_THREAD;
> @@ -37,12 +35,10 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
>  
>  static irqreturn_t isr_bh_routine(int irq, void *userdata)
>  {
> -	struct net_device *dev = userdata;
> -	struct wilc_vif *vif = netdev_priv(userdata);
> -	struct wilc *wilc = vif->wilc;
> +	struct wilc *wilc = (struct wilc *)userdata;

Same here.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wilc1000: use wilc handler as cookie in request_threaded_irq()
  2021-02-24 15:28 ` Kalle Valo
@ 2021-02-25  4:21   ` Ajay.Kathat
  0 siblings, 0 replies; 3+ messages in thread
From: Ajay.Kathat @ 2021-02-25  4:21 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Claudiu.Beznea

Hi Kalle,

On 24/02/21 8:58 pm, Kalle Valo wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> <Ajay.Kathat@microchip.com> writes:
> 
>> From: Ajay Singh <ajay.kathat@microchip.com>
>>
>> Use same cookie for request_threaded_irq() & free_irq() to properly free
>> IRQ during module unload. free_irq() already uses *wilc* handler so the
>> changes are required for request_threaded_irq().
>>
>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
>> ---
>>  drivers/net/wireless/microchip/wilc1000/netdev.c | 14 +++++---------
>>  1 file changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
>> index 1b205e7d97a8..66f725aad209 100644
>> --- a/drivers/net/wireless/microchip/wilc1000/netdev.c
>> +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
>> @@ -24,12 +24,10 @@
>>
>>  static irqreturn_t isr_uh_routine(int irq, void *user_data)
>>  {
>> -     struct net_device *dev = user_data;
>> -     struct wilc_vif *vif = netdev_priv(dev);
>> -     struct wilc *wilc = vif->wilc;
>> +     struct wilc *wilc = (struct wilc *)user_data;
> 
> No need to cast a void pointer.

Sure. I will submit V2 version for this patch by removing explicit cast.

Regards,
Ajay

> 
>>
>>       if (wilc->close) {
>> -             netdev_err(dev, "Can't handle UH interrupt\n");
>> +             pr_err("Can't handle UH interrupt");
>>               return IRQ_HANDLED;
>>       }
>>       return IRQ_WAKE_THREAD;
>> @@ -37,12 +35,10 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
>>
>>  static irqreturn_t isr_bh_routine(int irq, void *userdata)
>>  {
>> -     struct net_device *dev = userdata;
>> -     struct wilc_vif *vif = netdev_priv(userdata);
>> -     struct wilc *wilc = vif->wilc;
>> +     struct wilc *wilc = (struct wilc *)userdata;
> 
> Same here.
> 
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-25  4:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 12:21 [PATCH] wilc1000: use wilc handler as cookie in request_threaded_irq() Ajay.Kathat
2021-02-24 15:28 ` Kalle Valo
2021-02-25  4:21   ` Ajay.Kathat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.