Message ID | 20230206135016.6737-3-kaehndan@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Jiri Kosina |
Headers | show |
Series | DeviceTree Support for USB-HID Devices and CP2112 | expand |
Hi Danny, On Mon, Feb 06, 2023 at 07:50:14AM -0600, Danny Kaehn wrote: > USB HID core now shares its devicetree of_node with its child HID device. > Since there can only be one HID device on a USB interface, it is redundant > to specify a hid node under the USB device (and further, binding this way > isn't currently possible, as hid_driver does not support of_match_table). Why do we do that only for OF? Can we use device_set_node() instead? > > Signed-off-by: Danny Kaehn <kaehndan@gmail.com> > --- > drivers/hid/usbhid/hid-core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c > index be4c731aaa65..b6c968af258f 100644 > --- a/drivers/hid/usbhid/hid-core.c > +++ b/drivers/hid/usbhid/hid-core.c > @@ -33,6 +33,7 @@ > #include <linux/hiddev.h> > #include <linux/hid-debug.h> > #include <linux/hidraw.h> > +#include <linux/device.h> > #include "usbhid.h" > > /* > @@ -1369,6 +1370,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * > hid->hiddev_report_event = hiddev_report_event; > #endif > hid->dev.parent = &intf->dev; > + device_set_of_node_from_dev(&hid->dev, &intf->dev); > hid->bus = BUS_USB; > hid->vendor = le16_to_cpu(dev->descriptor.idVendor); > hid->product = le16_to_cpu(dev->descriptor.idProduct); > -- > 2.25.1 > Thanks.
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index be4c731aaa65..b6c968af258f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -33,6 +33,7 @@ #include <linux/hiddev.h> #include <linux/hid-debug.h> #include <linux/hidraw.h> +#include <linux/device.h> #include "usbhid.h" /* @@ -1369,6 +1370,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * hid->hiddev_report_event = hiddev_report_event; #endif hid->dev.parent = &intf->dev; + device_set_of_node_from_dev(&hid->dev, &intf->dev); hid->bus = BUS_USB; hid->vendor = le16_to_cpu(dev->descriptor.idVendor); hid->product = le16_to_cpu(dev->descriptor.idProduct);
USB HID core now shares its devicetree of_node with its child HID device. Since there can only be one HID device on a USB interface, it is redundant to specify a hid node under the USB device (and further, binding this way isn't currently possible, as hid_driver does not support of_match_table). Signed-off-by: Danny Kaehn <kaehndan@gmail.com> --- drivers/hid/usbhid/hid-core.c | 2 ++ 1 file changed, 2 insertions(+)