All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bluetooth] ieee802154: atusb: fix driver to work with older firmware versions
@ 2017-01-02 15:00 Stefan Schmidt
  2017-01-02 15:39 ` Alexander Aring
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schmidt @ 2017-01-02 15:00 UTC (permalink / raw)
  To: linux-wpan; +Cc: Alexander Aring, Stefan Schmidt

After the addition of the frame_retries callback we could run into cases where
a ATUSB device with an older firmware version would now longer be able to bring
the interface up.

We keep this functionality disabled now if the minimum firmware version for this
feature is not available.

Fixes: 5d82288b93db3bc ("ieee802154: atusb: implement .set_frame_retries
ops callback")
Reported-by: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 drivers/net/ieee802154/atusb.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 63cb679..ac32029 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -562,13 +562,6 @@ static int
 atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
 {
 	struct atusb *atusb = hw->priv;
-	struct device *dev = &atusb->usb_dev->dev;
-
-	if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) {
-		dev_info(dev, "Automatic frame retransmission is only available from "
-			"firmware version 0.3. Please update if you want this feature.");
-		return -EINVAL;
-	}
 
 	return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries);
 }
@@ -802,8 +795,7 @@ static int atusb_probe(struct usb_interface *interface,
 
 	hw->parent = &usb_dev->dev;
 	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
-		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS |
-		    IEEE802154_HW_FRAME_RETRIES;
+		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS;
 
 	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL |
 			 WPAN_PHY_FLAG_CCA_MODE;
@@ -832,6 +824,10 @@ static int atusb_probe(struct usb_interface *interface,
 	atusb_get_and_show_build(atusb);
 	atusb_set_extended_addr(atusb);
 
+	if (atusb->fw_ver_maj >= 0 && atusb->fw_ver_min >= 3) {
+		hw->flags |= IEEE802154_HW_FRAME_RETRIES;
+	}
+
 	ret = atusb_get_and_clear_error(atusb);
 	if (ret) {
 		dev_err(&atusb->usb_dev->dev,
-- 
2.5.5


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

* Re: [PATCH bluetooth] ieee802154: atusb: fix driver to work with older firmware versions
  2017-01-02 15:00 [PATCH bluetooth] ieee802154: atusb: fix driver to work with older firmware versions Stefan Schmidt
@ 2017-01-02 15:39 ` Alexander Aring
  2017-01-02 15:59   ` Stefan Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Aring @ 2017-01-02 15:39 UTC (permalink / raw)
  To: Stefan Schmidt; +Cc: linux-wpan


Hi Stefan,

thanks for the fix!

On 01/02/2017 04:00 PM, Stefan Schmidt wrote:
> After the addition of the frame_retries callback we could run into cases where
> a ATUSB device with an older firmware version would now longer be able to bring
> the interface up.
> 
> We keep this functionality disabled now if the minimum firmware version for this
> feature is not available.
> 
> Fixes: 5d82288b93db3bc ("ieee802154: atusb: implement .set_frame_retries
> ops callback")
> Reported-by: Alexander Aring <aar@pengutronix.de>
> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
> ---

Acked-by: Alexander Aring <aar@pengutronix.de>

>  drivers/net/ieee802154/atusb.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
> index 63cb679..ac32029 100644
> --- a/drivers/net/ieee802154/atusb.c
> +++ b/drivers/net/ieee802154/atusb.c
> @@ -562,13 +562,6 @@ static int
>  atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
>  {
>  	struct atusb *atusb = hw->priv;
> -	struct device *dev = &atusb->usb_dev->dev;
> -
> -	if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) {
> -		dev_info(dev, "Automatic frame retransmission is only available from "
> -			"firmware version 0.3. Please update if you want this feature.");
> -		return -EINVAL;
> -	}
>  
>  	return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries);
>  }
> @@ -802,8 +795,7 @@ static int atusb_probe(struct usb_interface *interface,
>  
>  	hw->parent = &usb_dev->dev;
>  	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
> -		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS |
> -		    IEEE802154_HW_FRAME_RETRIES;
> +		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS;
>  
>  	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL |
>  			 WPAN_PHY_FLAG_CCA_MODE;
> @@ -832,6 +824,10 @@ static int atusb_probe(struct usb_interface *interface,
>  	atusb_get_and_show_build(atusb);
>  	atusb_set_extended_addr(atusb);
>  
> +	if (atusb->fw_ver_maj >= 0 && atusb->fw_ver_min >= 3) {
> +		hw->flags |= IEEE802154_HW_FRAME_RETRIES;
> +	}
> +

nitpick, remove brackets? Checkpatch should complain about that, I
suppose.

- Alex

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

* Re: [PATCH bluetooth] ieee802154: atusb: fix driver to work with older firmware versions
  2017-01-02 15:39 ` Alexander Aring
@ 2017-01-02 15:59   ` Stefan Schmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Schmidt @ 2017-01-02 15:59 UTC (permalink / raw)
  To: Alexander Aring; +Cc: linux-wpan

Hello.

On 02/01/17 16:39, Alexander Aring wrote:
>
> Hi Stefan,
>
> thanks for the fix!
>
> On 01/02/2017 04:00 PM, Stefan Schmidt wrote:
>> After the addition of the frame_retries callback we could run into cases where
>> a ATUSB device with an older firmware version would now longer be able to bring
>> the interface up.
>>
>> We keep this functionality disabled now if the minimum firmware version for this
>> feature is not available.
>>
>> Fixes: 5d82288b93db3bc ("ieee802154: atusb: implement .set_frame_retries
>> ops callback")
>> Reported-by: Alexander Aring <aar@pengutronix.de>
>> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
>> ---
>
> Acked-by: Alexander Aring <aar@pengutronix.de>
>
>>  drivers/net/ieee802154/atusb.c | 14 +++++---------
>>  1 file changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
>> index 63cb679..ac32029 100644
>> --- a/drivers/net/ieee802154/atusb.c
>> +++ b/drivers/net/ieee802154/atusb.c
>> @@ -562,13 +562,6 @@ static int
>>  atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
>>  {
>>  	struct atusb *atusb = hw->priv;
>> -	struct device *dev = &atusb->usb_dev->dev;
>> -
>> -	if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) {
>> -		dev_info(dev, "Automatic frame retransmission is only available from "
>> -			"firmware version 0.3. Please update if you want this feature.");
>> -		return -EINVAL;
>> -	}
>>
>>  	return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries);
>>  }
>> @@ -802,8 +795,7 @@ static int atusb_probe(struct usb_interface *interface,
>>
>>  	hw->parent = &usb_dev->dev;
>>  	hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
>> -		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS |
>> -		    IEEE802154_HW_FRAME_RETRIES;
>> +		    IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS;
>>
>>  	hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL |
>>  			 WPAN_PHY_FLAG_CCA_MODE;
>> @@ -832,6 +824,10 @@ static int atusb_probe(struct usb_interface *interface,
>>  	atusb_get_and_show_build(atusb);
>>  	atusb_set_extended_addr(atusb);
>>
>> +	if (atusb->fw_ver_maj >= 0 && atusb->fw_ver_min >= 3) {
>> +		hw->flags |= IEEE802154_HW_FRAME_RETRIES;
>> +	}
>> +
>
> nitpick, remove brackets? Checkpatch should complain about that, I
> suppose.

Fair enough. I'm just to used to this. Version 2 with the parenthesis 
removed and your ack added.

regards
Stefan Schmidt

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

end of thread, other threads:[~2017-01-02 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 15:00 [PATCH bluetooth] ieee802154: atusb: fix driver to work with older firmware versions Stefan Schmidt
2017-01-02 15:39 ` Alexander Aring
2017-01-02 15:59   ` Stefan Schmidt

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.