rft:hso cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

this needs testing.

	Regards
		Oliver

--

>From 1fff8219bdad14edd78a1a031894887ccee9cd07 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@xxxxxxxxxx>
Date: Tue, 15 Feb 2011 22:31:04 +0100
Subject: [PATCH] hso:convert driver to newer API

The driver becomes cleaner using the _async() APIs

Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
---
 drivers/net/usb/hso.c |   26 ++------------------------
 1 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index bed8fce..acd3011 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -283,8 +283,6 @@ struct hso_device {
 
 	u8 is_active;
 	u8 usb_gone;
-	struct work_struct async_get_intf;
-	struct work_struct async_put_intf;
 	struct work_struct reset_device;
 
 	struct usb_device *usb;
@@ -346,8 +344,6 @@ static int hso_stop_net_device(struct hso_device *hso_dev);
 static void hso_serial_ref_free(struct kref *ref);
 static void hso_std_serial_read_bulk_callback(struct urb *urb);
 static int hso_mux_serial_read(struct hso_serial *serial);
-static void async_get_intf(struct work_struct *data);
-static void async_put_intf(struct work_struct *data);
 static int hso_put_activity(struct hso_device *hso_dev);
 static int hso_get_activity(struct hso_device *hso_dev);
 static void tiocmget_intr_callback(struct urb *urb);
@@ -2387,8 +2383,6 @@ static struct hso_device *hso_create_device(struct usb_interface *intf,
 	kref_init(&hso_dev->ref);
 	mutex_init(&hso_dev->mutex);
 
-	INIT_WORK(&hso_dev->async_get_intf, async_get_intf);
-	INIT_WORK(&hso_dev->async_put_intf, async_put_intf);
 	INIT_WORK(&hso_dev->reset_device, reset_device);
 
 	return hso_dev;
@@ -3016,26 +3010,12 @@ static void hso_disconnect(struct usb_interface *interface)
 	usb_set_intfdata(interface, NULL);
 }
 
-static void async_get_intf(struct work_struct *data)
-{
-	struct hso_device *hso_dev =
-	    container_of(data, struct hso_device, async_get_intf);
-	usb_autopm_get_interface(hso_dev->interface);
-}
-
-static void async_put_intf(struct work_struct *data)
-{
-	struct hso_device *hso_dev =
-	    container_of(data, struct hso_device, async_put_intf);
-	usb_autopm_put_interface(hso_dev->interface);
-}
-
 static int hso_get_activity(struct hso_device *hso_dev)
 {
 	if (hso_dev->usb->state == USB_STATE_SUSPENDED) {
 		if (!hso_dev->is_active) {
 			hso_dev->is_active = 1;
-			schedule_work(&hso_dev->async_get_intf);
+			usb_autopm_get_interface_async(hso_dev->interface);
 		}
 	}
 
@@ -3052,7 +3032,7 @@ static int hso_put_activity(struct hso_device *hso_dev)
 	if (hso_dev->usb->state != USB_STATE_SUSPENDED) {
 		if (hso_dev->is_active) {
 			hso_dev->is_active = 0;
-			schedule_work(&hso_dev->async_put_intf);
+			usb_autopm_put_interface_async(hso_dev->interface);
 			return -EAGAIN;
 		}
 	}
@@ -3192,8 +3172,6 @@ static void hso_free_interface(struct usb_interface *interface)
 			 * traffic needs to start it again when suspended */
 			netif_stop_queue(dev2net(network_table[i])->net);
 			hso_stop_net_device(network_table[i]);
-			cancel_work_sync(&network_table[i]->async_put_intf);
-			cancel_work_sync(&network_table[i]->async_get_intf);
 			if (rfk) {
 				rfkill_unregister(rfk);
 				rfkill_destroy(rfk);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux