Skip to content

Commit 7957501

Browse files
jirislabyJiri Kosina
authored andcommitted
HID: convert to dev_* prints
Since we have a real device bound to a driver, we may use struct device for printing. Use dev_* functions instead of printks in 4 drivers. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 76483cf commit 7957501

4 files changed

Lines changed: 27 additions & 24 deletions

File tree

‎drivers/hid/hid-lg2ff.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ int lg2ff_init(struct hid_device *hid)
7171
int error;
7272

7373
if (list_empty(report_list)) {
74-
printk(KERN_ERR "hid-lg2ff: no output report found\n");
74+
dev_err(&hid->dev, "no output report found\n");
7575
return -ENODEV;
7676
}
7777

7878
report = list_entry(report_list->next, struct hid_report, list);
7979

8080
if (report->maxfield < 1) {
81-
printk(KERN_ERR "hid-lg2ff: output report is empty\n");
81+
dev_err(&hid->dev, "output report is empty\n");
8282
return -ENODEV;
8383
}
8484
if (report->field[0]->report_count < 7) {
85-
printk(KERN_ERR "hid-lg2ff: not enough values in the field\n");
85+
dev_err(&hid->dev, "not enough values in the field\n");
8686
return -ENODEV;
8787
}
8888

@@ -109,7 +109,7 @@ int lg2ff_init(struct hid_device *hid)
109109

110110
usbhid_submit_report(hid, report, USB_DIR_OUT);
111111

112-
printk(KERN_INFO "Force feedback for Logitech Rumblepad 2 by "
112+
dev_info(&hid->dev, "Force feedback for Logitech Rumblepad 2 by "
113113
"Anssi Hannula <anssi.hannula@gmail.com>\n");
114114

115115
return 0;

‎drivers/hid/hid-pl.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int plff_init(struct hid_device *hid)
9090
currently unknown. */
9191

9292
if (list_empty(report_list)) {
93-
printk(KERN_ERR "hid-plff: no output reports found\n");
93+
dev_err(&hid->dev, "no output reports found\n");
9494
return -ENODEV;
9595
}
9696

@@ -99,18 +99,19 @@ static int plff_init(struct hid_device *hid)
9999
report_ptr = report_ptr->next;
100100

101101
if (report_ptr == report_list) {
102-
printk(KERN_ERR "hid-plff: required output report is missing\n");
102+
dev_err(&hid->dev, "required output report is "
103+
"missing\n");
103104
return -ENODEV;
104105
}
105106

106107
report = list_entry(report_ptr, struct hid_report, list);
107108
if (report->maxfield < 1) {
108-
printk(KERN_ERR "hid-plff: no fields in the report\n");
109+
dev_err(&hid->dev, "no fields in the report\n");
109110
return -ENODEV;
110111
}
111112

112113
if (report->field[0]->report_count < 4) {
113-
printk(KERN_ERR "hid-plff: not enough values in the field\n");
114+
dev_err(&hid->dev, "not enough values in the field\n");
114115
return -ENODEV;
115116
}
116117

@@ -136,7 +137,7 @@ static int plff_init(struct hid_device *hid)
136137
usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
137138
}
138139

139-
printk(KERN_INFO "hid-plff: Force feedback for PantherLord/GreenAsia "
140+
dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia "
140141
"devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
141142

142143
return 0;

‎drivers/hid/hid-tmff.c‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,28 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
149149
switch (field->usage[0].hid) {
150150
case THRUSTMASTER_USAGE_FF:
151151
if (field->report_count < 2) {
152-
warn("ignoring FF field with "
153-
"report_count < 2");
152+
dev_warn(&hid->dev, "ignoring FF field "
153+
"with report_count < 2\n");
154154
continue;
155155
}
156156

157157
if (field->logical_maximum ==
158158
field->logical_minimum) {
159-
warn("ignoring FF field with "
160-
"logical_maximum == "
161-
"logical_minimum");
159+
dev_warn(&hid->dev, "ignoring FF field "
160+
"with logical_maximum "
161+
"== logical_minimum\n");
162162
continue;
163163
}
164164

165165
if (tmff->report && tmff->report != report) {
166-
warn("ignoring FF field in other "
167-
"report");
166+
dev_warn(&hid->dev, "ignoring FF field "
167+
"in other report\n");
168168
continue;
169169
}
170170

171171
if (tmff->ff_field && tmff->ff_field != field) {
172-
warn("ignoring duplicate FF field");
172+
dev_warn(&hid->dev, "ignoring "
173+
"duplicate FF field\n");
173174
continue;
174175
}
175176

@@ -182,15 +183,16 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
182183
break;
183184

184185
default:
185-
warn("ignoring unknown output usage %08x",
186+
dev_warn(&hid->dev, "ignoring unknown output "
187+
"usage %08x\n",
186188
field->usage[0].hid);
187189
continue;
188190
}
189191
}
190192
}
191193

192194
if (!tmff->report) {
193-
err("cant find FF field in output reports\n");
195+
dev_err(&hid->dev, "can't find FF field in output reports\n");
194196
error = -ENODEV;
195197
goto fail;
196198
}
@@ -199,8 +201,8 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
199201
if (error)
200202
goto fail;
201203

202-
info("Force feedback for ThrustMaster devices by Zinx Verituse "
203-
"<zinx@epicsol.org>");
204+
dev_info(&hid->dev, "force feedback for ThrustMaster devices by Zinx "
205+
"Verituse <zinx@epicsol.org>");
204206
return 0;
205207

206208
fail:

‎drivers/hid/hid-zpff.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ static int zpff_init(struct hid_device *hid)
7373
int error;
7474

7575
if (list_empty(report_list)) {
76-
printk(KERN_ERR "hid-zpff: no output report found\n");
76+
dev_err(&hid->dev, "no output report found\n");
7777
return -ENODEV;
7878
}
7979

8080
report = list_entry(report_list->next, struct hid_report, list);
8181

8282
if (report->maxfield < 4) {
83-
printk(KERN_ERR "hid-zpff: not enough fields in report\n");
83+
dev_err(&hid->dev, "not enough fields in report\n");
8484
return -ENODEV;
8585
}
8686

@@ -103,7 +103,7 @@ static int zpff_init(struct hid_device *hid)
103103
zpff->report->field[3]->value[0] = 0x00;
104104
usbhid_submit_report(hid, zpff->report, USB_DIR_OUT);
105105

106-
printk(KERN_INFO "Force feedback for Zeroplus based devices by "
106+
dev_info(&hid->dev, "force feedback for Zeroplus based devices by "
107107
"Anssi Hannula <anssi.hannula@gmail.com>\n");
108108

109109
return 0;

0 commit comments

Comments
 (0)