Merge branch 'for-6.1/logitech' into for-linus
[linux-block.git] / drivers / hid / hid-core.c
index 72f8d8835b34ca6be574f17aec784c2518259d91..9c1d31f63f850860ca9c672fbf43b586c13c566f 100644 (file)
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle
  */
 
 struct hid_report *hid_register_report(struct hid_device *device,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int application)
 {
        struct hid_report_enum *report_enum = device->report_enum + type;
@@ -967,7 +967,7 @@ static const char * const hid_report_names[] = {
  * parsing.
  */
 struct hid_report *hid_validate_values(struct hid_device *hid,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int field_index,
                                       unsigned int report_counts)
 {
@@ -1921,7 +1921,7 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
  * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
  */
 int __hid_request(struct hid_device *hid, struct hid_report *report,
-               int reqtype)
+               enum hid_class_request reqtype)
 {
        char *buf;
        int ret;
@@ -1954,8 +1954,8 @@ out:
 }
 EXPORT_SYMBOL_GPL(__hid_request);
 
-int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
-               int interrupt)
+int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                        int interrupt)
 {
        struct hid_report_enum *report_enum = hid->report_enum + type;
        struct hid_report *report;
@@ -2019,7 +2019,8 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
  *
  * This is data entry for lower layers.
  */
-int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
+int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                    int interrupt)
 {
        struct hid_report_enum *report_enum;
        struct hid_driver *hdrv;
@@ -2353,7 +2354,7 @@ EXPORT_SYMBOL_GPL(hid_hw_close);
  * @reqtype: hid request type
  */
 void hid_hw_request(struct hid_device *hdev,
-                   struct hid_report *report, int reqtype)
+                   struct hid_report *report, enum hid_class_request reqtype)
 {
        if (hdev->ll_driver->request)
                return hdev->ll_driver->request(hdev, report, reqtype);
@@ -2378,7 +2379,7 @@ EXPORT_SYMBOL_GPL(hid_hw_request);
  */
 int hid_hw_raw_request(struct hid_device *hdev,
                       unsigned char reportnum, __u8 *buf,
-                      size_t len, unsigned char rtype, int reqtype)
+                      size_t len, enum hid_report_type rtype, enum hid_class_request reqtype)
 {
        if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
                return -EINVAL;
@@ -2740,10 +2741,12 @@ int hid_add_device(struct hid_device *hdev)
                        hid_warn(hdev, "bad device descriptor (%d)\n", ret);
        }
 
+       hdev->id = atomic_inc_return(&id);
+
        /* XXX hack, any other cleaner solution after the driver core
         * is converted to allow more than 20 bytes as the device name? */
        dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
-                    hdev->vendor, hdev->product, atomic_inc_return(&id));
+                    hdev->vendor, hdev->product, hdev->id);
 
        hid_debug_register(hdev, dev_name(&hdev->dev));
        ret = device_add(&hdev->dev);