Commit 38121067 authored by Olivier Sobrie's avatar Olivier Sobrie Committed by David S. Miller

hso: fix rfkill name conflicts

By using only the usb interface number for the rfkill name, we might
have a name conflicts in case two similar hso devices are connected.

In this patch, the name of the hso rfkill interface embed the value
of a counter that is incremented each time a new rfkill interface is
added.
Suggested-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarOlivier Sobrie <olivier@sobrie.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc491970
...@@ -153,7 +153,7 @@ struct hso_net { ...@@ -153,7 +153,7 @@ struct hso_net {
struct hso_device *parent; struct hso_device *parent;
struct net_device *net; struct net_device *net;
struct rfkill *rfkill; struct rfkill *rfkill;
char name[8]; char name[24];
struct usb_endpoint_descriptor *in_endp; struct usb_endpoint_descriptor *in_endp;
struct usb_endpoint_descriptor *out_endp; struct usb_endpoint_descriptor *out_endp;
...@@ -2469,9 +2469,10 @@ static void hso_create_rfkill(struct hso_device *hso_dev, ...@@ -2469,9 +2469,10 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
{ {
struct hso_net *hso_net = dev2net(hso_dev); struct hso_net *hso_net = dev2net(hso_dev);
struct device *dev = &hso_net->net->dev; struct device *dev = &hso_net->net->dev;
static u32 rfkill_counter;
snprintf(hso_net->name, sizeof(hso_net->name), "hso-%d", snprintf(hso_net->name, sizeof(hso_net->name), "hso-%d",
interface->altsetting->desc.bInterfaceNumber); rfkill_counter++);
hso_net->rfkill = rfkill_alloc(hso_net->name, hso_net->rfkill = rfkill_alloc(hso_net->name,
&interface_to_usbdev(interface)->dev, &interface_to_usbdev(interface)->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment