aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2009-02-20 06:47:08 -0500
committerJiri Kosina <jkosina@suse.cz>2009-03-25 12:57:58 -0400
commitae2f007468223e9efd6973be0364b9307a050a0c (patch)
tree2fbf929661f078626998691012ba64afb471c212 /drivers/hid/usbhid
parent378a0ede126a2c59ab9ea1771de624521db5053e (diff)
HID: hid_reset_resume() needs to be defined only when CONFIG_PM is set
There is no point of having hid_reset_resume() when CONFIG_PM is not set, and even the corresponding .reset_resume pointer in hid_driver struct is properly ifdefed. Move the definition into the ifdef CONFIG_PM part of the source to avoid drivers/hid/usbhid/hid-core.c:1337: warning: 'hid_reset_resume' defined but not used Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/hid-core.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index d79100a01b05..054f0c521e6f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1210,6 +1210,56 @@ static void hid_cease_io(struct usbhid_device *usbhid)
1210 flush_scheduled_work(); 1210 flush_scheduled_work();
1211} 1211}
1212 1212
1213/* Treat USB reset pretty much the same as suspend/resume */
1214static int hid_pre_reset(struct usb_interface *intf)
1215{
1216 struct hid_device *hid = usb_get_intfdata(intf);
1217 struct usbhid_device *usbhid = hid->driver_data;
1218
1219 spin_lock_irq(&usbhid->lock);
1220 set_bit(HID_RESET_PENDING, &usbhid->iofl);
1221 spin_unlock_irq(&usbhid->lock);
1222 hid_cease_io(usbhid);
1223
1224 return 0;
1225}
1226
1227/* Same routine used for post_reset and reset_resume */
1228static int hid_post_reset(struct usb_interface *intf)
1229{
1230 struct usb_device *dev = interface_to_usbdev (intf);
1231 struct hid_device *hid = usb_get_intfdata(intf);
1232 struct usbhid_device *usbhid = hid->driver_data;
1233 int status;
1234
1235 spin_lock_irq(&usbhid->lock);
1236 clear_bit(HID_RESET_PENDING, &usbhid->iofl);
1237 spin_unlock_irq(&usbhid->lock);
1238 hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0);
1239 /* FIXME: Any more reinitialization needed? */
1240 status = hid_start_in(hid);
1241 if (status < 0)
1242 hid_io_error(hid);
1243 usbhid_restart_queues(usbhid);
1244
1245 return 0;
1246}
1247
1248int usbhid_get_power(struct hid_device *hid)
1249{
1250 struct usbhid_device *usbhid = hid->driver_data;
1251
1252 return usb_autopm_get_interface(usbhid->intf);
1253}
1254
1255void usbhid_put_power(struct hid_device *hid)
1256{
1257 struct usbhid_device *usbhid = hid->driver_data;
1258
1259 usb_autopm_put_interface(usbhid->intf);
1260}
1261
1262
1213#ifdef CONFIG_PM 1263#ifdef CONFIG_PM
1214static int hid_suspend(struct usb_interface *intf, pm_message_t message) 1264static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1215{ 1265{
@@ -1293,43 +1343,6 @@ static int hid_resume(struct usb_interface *intf)
1293 return 0; 1343 return 0;
1294} 1344}
1295 1345
1296#endif /* CONFIG_PM */
1297
1298/* Treat USB reset pretty much the same as suspend/resume */
1299static int hid_pre_reset(struct usb_interface *intf)
1300{
1301 struct hid_device *hid = usb_get_intfdata(intf);
1302 struct usbhid_device *usbhid = hid->driver_data;
1303
1304 spin_lock_irq(&usbhid->lock);
1305 set_bit(HID_RESET_PENDING, &usbhid->iofl);
1306 spin_unlock_irq(&usbhid->lock);
1307 hid_cease_io(usbhid);
1308
1309 return 0;
1310}
1311
1312/* Same routine used for post_reset and reset_resume */
1313static int hid_post_reset(struct usb_interface *intf)
1314{
1315 struct usb_device *dev = interface_to_usbdev (intf);
1316 struct hid_device *hid = usb_get_intfdata(intf);
1317 struct usbhid_device *usbhid = hid->driver_data;
1318 int status;
1319
1320 spin_lock_irq(&usbhid->lock);
1321 clear_bit(HID_RESET_PENDING, &usbhid->iofl);
1322 spin_unlock_irq(&usbhid->lock);
1323 hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0);
1324 /* FIXME: Any more reinitialization needed? */
1325 status = hid_start_in(hid);
1326 if (status < 0)
1327 hid_io_error(hid);
1328 usbhid_restart_queues(usbhid);
1329
1330 return 0;
1331}
1332
1333static int hid_reset_resume(struct usb_interface *intf) 1346static int hid_reset_resume(struct usb_interface *intf)
1334{ 1347{
1335 struct hid_device *hid = usb_get_intfdata(intf); 1348 struct hid_device *hid = usb_get_intfdata(intf);
@@ -1339,19 +1352,7 @@ static int hid_reset_resume(struct usb_interface *intf)
1339 return hid_post_reset(intf); 1352 return hid_post_reset(intf);
1340} 1353}
1341 1354
1342int usbhid_get_power(struct hid_device *hid) 1355#endif /* CONFIG_PM */
1343{
1344 struct usbhid_device *usbhid = hid->driver_data;
1345
1346 return usb_autopm_get_interface(usbhid->intf);
1347}
1348
1349void usbhid_put_power(struct hid_device *hid)
1350{
1351 struct usbhid_device *usbhid = hid->driver_data;
1352
1353 usb_autopm_put_interface(usbhid->intf);
1354}
1355 1356
1356static struct usb_device_id hid_usb_ids [] = { 1357static struct usb_device_id hid_usb_ids [] = {
1357 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, 1358 { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,