Commit 18fcac35 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] USB Serial: get rid of the .owner field in usb_serial_driver

Don't duplicate something that's already in struct driver.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ea65370d
......@@ -31,7 +31,9 @@ static struct usb_driver airprime_driver = {
};
static struct usb_serial_driver airprime_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "airprime",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -122,7 +122,9 @@ static struct usb_driver belkin_driver = {
/* All of the device info needed for the serial converters */
static struct usb_serial_driver belkin_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Belkin / Peracom / GoHubs USB Serial Adapter",
.short_name = "belkin",
.id_table = id_table_combined,
......
......@@ -57,13 +57,13 @@ static int usb_serial_device_probe (struct device *dev)
driver = port->serial->type;
if (driver->port_probe) {
if (!try_module_get(driver->owner)) {
if (!try_module_get(driver->driver.owner)) {
dev_err(dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
retval = driver->port_probe (port);
module_put(driver->owner);
module_put(driver->driver.owner);
if (retval)
goto exit;
}
......@@ -92,13 +92,13 @@ static int usb_serial_device_remove (struct device *dev)
driver = port->serial->type;
if (driver->port_remove) {
if (!try_module_get(driver->owner)) {
if (!try_module_get(driver->driver.owner)) {
dev_err(dev, "module get failed, exiting\n");
retval = -EIO;
goto exit;
}
retval = driver->port_remove (port);
module_put(driver->owner);
module_put(driver->driver.owner);
}
exit:
minor = port->number;
......@@ -120,7 +120,6 @@ int usb_serial_bus_register(struct usb_serial_driver *driver)
driver->driver.bus = &usb_serial_bus_type;
driver->driver.probe = usb_serial_device_probe;
driver->driver.remove = usb_serial_device_remove;
driver->driver.owner = driver->owner;
retval = driver_register(&driver->driver);
......
......@@ -74,7 +74,9 @@ static struct usb_driver cp2101_driver = {
};
static struct usb_serial_driver cp2101_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "CP2101",
.id_table = id_table,
.num_interrupt_in = 0,
......
......@@ -84,7 +84,9 @@ static struct usb_driver cyberjack_driver = {
};
static struct usb_serial_driver cyberjack_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Reiner SCT Cyberjack USB card reader",
.short_name = "cyberjack",
.id_table = id_table,
......
......@@ -177,7 +177,9 @@ static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, unsigne
static struct usb_serial_driver cypress_earthmate_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "DeLorme Earthmate USB",
.short_name = "earthmate",
.id_table = id_table_earthmate,
......@@ -204,7 +206,9 @@ static struct usb_serial_driver cypress_earthmate_device = {
};
static struct usb_serial_driver cypress_hidcom_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "HID->COM RS232 Adapter",
.short_name = "cyphidcom",
.id_table = id_table_cyphidcomrs232,
......
......@@ -504,7 +504,9 @@ static struct usb_driver digi_driver = {
/* device info needed for the Digi serial converter */
static struct usb_serial_driver digi_acceleport_2_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Digi 2 port USB adapter",
.short_name = "digi_2",
.id_table = id_table_2,
......@@ -531,7 +533,9 @@ static struct usb_serial_driver digi_acceleport_2_device = {
};
static struct usb_serial_driver digi_acceleport_4_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Digi 4 port USB adapter",
.short_name = "digi_4",
.id_table = id_table_4,
......
......@@ -113,7 +113,9 @@ static struct usb_driver empeg_driver = {
};
static struct usb_serial_driver empeg_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Empeg",
.id_table = id_table,
.num_interrupt_in = 0,
......
......@@ -563,7 +563,9 @@ static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base);
static __u32 ftdi_232bm_baud_to_divisor (int baud);
static struct usb_serial_driver ftdi_sio_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "FTDI USB Serial Device",
.short_name = "ftdi_sio",
.id_table = id_table_combined,
......
......@@ -1470,7 +1470,9 @@ static void garmin_shutdown (struct usb_serial *serial)
/* All of the device info needed */
static struct usb_serial_driver garmin_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Garmin GPS usb/tty",
.short_name = "garmin_gps",
.id_table = id_table,
......
......@@ -37,7 +37,9 @@ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
/* All of the device info needed for the Generic Serial Converter */
struct usb_serial_driver usb_serial_generic_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Generic",
.short_name = "generic",
.id_table = generic_device_ids,
......
......@@ -45,7 +45,9 @@ static struct usb_driver hp49gp_driver = {
};
static struct usb_serial_driver hp49gp_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "HP4X",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -76,7 +76,9 @@ static struct usb_device_id id_table_combined [] = {
MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_serial_driver edgeport_2port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Edgeport 2 port adapter",
.short_name = "edgeport_2",
.id_table = edgeport_2port_id_table,
......@@ -104,7 +106,9 @@ static struct usb_serial_driver edgeport_2port_device = {
};
static struct usb_serial_driver edgeport_4port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Edgeport 4 port adapter",
.short_name = "edgeport_4",
.id_table = edgeport_4port_id_table,
......@@ -132,7 +136,9 @@ static struct usb_serial_driver edgeport_4port_device = {
};
static struct usb_serial_driver edgeport_8port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Edgeport 8 port adapter",
.short_name = "edgeport_8",
.id_table = edgeport_8port_id_table,
......
......@@ -2983,7 +2983,9 @@ static unsigned int edge_buf_get(struct edge_buf *eb, char *buf,
static struct usb_serial_driver edgeport_1port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Edgeport TI 1 port adapter",
.short_name = "edgeport_ti_1",
.id_table = edgeport_1port_id_table,
......@@ -3011,7 +3013,9 @@ static struct usb_serial_driver edgeport_1port_device = {
};
static struct usb_serial_driver edgeport_2port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Edgeport TI 2 port adapter",
.short_name = "edgeport_ti_2",
.id_table = edgeport_2port_id_table,
......
......@@ -548,7 +548,9 @@ static struct usb_driver ipaq_driver = {
/* All of the device info needed for the Compaq iPAQ */
static struct usb_serial_driver ipaq_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "PocketPC PDA",
.id_table = ipaq_id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -444,7 +444,9 @@ static int ipw_disconnect(struct usb_serial_port *port)
}
static struct usb_serial_driver ipw_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "IPWireless converter",
.short_name = "ipw",
.id_table = usb_ipw_ids,
......
......@@ -134,7 +134,9 @@ static struct usb_driver ir_driver = {
static struct usb_serial_driver ir_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "IR Dongle",
.id_table = id_table,
.num_interrupt_in = 1,
......
......@@ -571,7 +571,9 @@ static struct usb_device_id keyspan_4port_ids[] = {
/* Structs for the devices, pre and post renumeration. */
static struct usb_serial_driver keyspan_pre_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan - (without firmware)",
.short_name = "keyspan_no_firm",
.id_table = keyspan_pre_ids,
......@@ -583,7 +585,9 @@ static struct usb_serial_driver keyspan_pre_device = {
};
static struct usb_serial_driver keyspan_1port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan 1 port adapter",
.short_name = "keyspan_1",
.id_table = keyspan_1port_ids,
......@@ -608,7 +612,9 @@ static struct usb_serial_driver keyspan_1port_device = {
};
static struct usb_serial_driver keyspan_2port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan 2 port adapter",
.short_name = "keyspan_2",
.id_table = keyspan_2port_ids,
......@@ -633,7 +639,9 @@ static struct usb_serial_driver keyspan_2port_device = {
};
static struct usb_serial_driver keyspan_4port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan 4 port adapter",
.short_name = "keyspan_4",
.id_table = keyspan_4port_ids,
......
......@@ -784,7 +784,9 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
#ifdef KEYSPAN
static struct usb_serial_driver keyspan_pda_fake_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan PDA - (prerenumeration)",
.short_name = "keyspan_pda_pre",
.id_table = id_table_fake,
......@@ -798,7 +800,9 @@ static struct usb_serial_driver keyspan_pda_fake_device = {
#ifdef XIRCOM
static struct usb_serial_driver xircom_pgs_fake_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Xircom / Entregra PGS - (prerenumeration)",
.short_name = "xircom_no_firm",
.id_table = id_table_fake_xircom,
......@@ -811,7 +815,9 @@ static struct usb_serial_driver xircom_pgs_fake_device = {
#endif
static struct usb_serial_driver keyspan_pda_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Keyspan PDA",
.short_name = "keyspan_pda",
.id_table = id_table_std,
......
......@@ -124,7 +124,9 @@ static struct usb_driver kl5kusb105d_driver = {
};
static struct usb_serial_driver kl5kusb105d_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "KL5KUSB105D / PalmConnect",
.short_name = "kl5kusb105d",
.id_table = id_table,
......
......@@ -106,7 +106,9 @@ static struct usb_driver kobil_driver = {
static struct usb_serial_driver kobil_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "KOBIL USB smart card terminal",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -133,7 +133,9 @@ static struct usb_driver mct_u232_driver = {
};
static struct usb_serial_driver mct_u232_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "MCT U232",
.short_name = "mct_u232",
.id_table = id_table_combined,
......
......@@ -89,7 +89,9 @@ static struct usb_driver omninet_driver = {
static struct usb_serial_driver zyxel_omninet_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "ZyXEL - omni.net lcd plus usb",
.short_name = "omninet",
.id_table = id_table,
......
......@@ -106,7 +106,9 @@ static struct usb_driver option_driver = {
* recognizes separately, thus num_port=1.
*/
static struct usb_serial_driver option_3port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Option 3G data card",
.short_name = "option",
.id_table = option_ids,
......
......@@ -176,7 +176,9 @@ static unsigned int pl2303_buf_get(struct pl2303_buf *pb, char *buf,
/* All of the device info needed for the PL2303 SIO serial converter */
static struct usb_serial_driver pl2303_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "PL-2303",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -398,7 +398,9 @@ static int safe_startup (struct usb_serial *serial)
}
static struct usb_serial_driver safe_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Safe",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
......
......@@ -256,7 +256,9 @@ static struct usb_driver ti_usb_driver = {
};
static struct usb_serial_driver ti_1port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "TI USB 3410 1 port adapter",
.id_table = ti_id_table_3410,
.num_interrupt_in = 1,
......@@ -283,7 +285,9 @@ static struct usb_serial_driver ti_1port_device = {
};
static struct usb_serial_driver ti_2port_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "TI USB 5052 2 port adapter",
.id_table = ti_id_table_5052,
.num_interrupt_in = 1,
......
......@@ -507,7 +507,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
/* lock this module before we call it
* this may fail, which means we must bail out,
* safe because we are called with BKL held */
if (!try_module_get(serial->type->owner)) {
if (!try_module_get(serial->type->driver.owner)) {
retval = -ENODEV;
goto bailout_kref_put;
}
......@@ -522,7 +522,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
return 0;
bailout_module_put:
module_put(serial->type->owner);
module_put(serial->type->driver.owner);
bailout_kref_put:
kref_put(&serial->kref, destroy_serial);
port->open_count = 0;
......@@ -553,7 +553,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
port->tty = NULL;
}
module_put(port->serial->type->owner);
module_put(port->serial->type->driver.owner);
}
kref_put(&port->serial->kref, destroy_serial);
......@@ -718,8 +718,8 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int
continue;
length += sprintf (page+length, "%d:", i);
if (serial->type->owner)
length += sprintf (page+length, " module:%s", module_name(serial->type->owner));
if (serial->type->driver.owner)
length += sprintf (page+length, " module:%s", module_name(serial->type->driver.owner));
length += sprintf (page+length, " name:\"%s\"", serial->type->name);
length += sprintf (page+length, " vendor:%04x product:%04x",
le16_to_cpu(serial->dev->descriptor.idVendor),
......@@ -900,7 +900,7 @@ int usb_serial_probe(struct usb_interface *interface,
if (type->probe) {
const struct usb_device_id *id;
if (!try_module_get(type->owner)) {
if (!try_module_get(type->driver.owner)) {
dev_err(&interface->dev, "module get failed, exiting\n");
kfree (serial);
return -EIO;
......@@ -908,7 +908,7 @@ int usb_serial_probe(struct usb_interface *interface,
id = usb_match_id(interface, type->id_table);
retval = type->probe(serial, id);
module_put(type->owner);
module_put(type->driver.owner);
if (retval) {
dbg ("sub driver rejected device");
......@@ -1007,13 +1007,13 @@ int usb_serial_probe(struct usb_interface *interface,
if (!num_ports) {
/* if this device type has a calc_num_ports function, call it */
if (type->calc_num_ports) {
if (!try_module_get(type->owner)) {
if (!try_module_get(type->driver.owner)) {
dev_err(&interface->dev, "module get failed, exiting\n");
kfree (serial);
return -EIO;
}
num_ports = type->calc_num_ports (serial);
module_put(type->owner);
module_put(type->driver.owner);
}
if (!num_ports)
num_ports = type->num_ports;
......@@ -1158,12 +1158,12 @@ int usb_serial_probe(struct usb_interface *interface,
/* if this device type has an attach function, call it */
if (type->attach) {
if (!try_module_get(type->owner)) {
if (!try_module_get(type->driver.owner)) {
dev_err(&interface->dev, "module get failed, exiting\n");
goto probe_error;
}
retval = type->attach (serial);
module_put(type->owner);
module_put(type->driver.owner);
if (retval < 0)
goto probe_error;
if (retval > 0) {
......
......@@ -189,7 +189,6 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
/**
* usb_serial_driver - describes a usb serial driver
* @owner: pointer to the module that owns this driver.
* @name: pointer to a string that describes this driver. This string used
* in the syslog messages when a device is inserted or removed.
* @short_name: a pointer to a string that describes this driver in
......@@ -226,9 +225,11 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
* pointers are defined, then the USB serial core code will call them when
* the corresponding tty port functions are called. If they are not
* called, the generic serial function will be used instead.
*
* The driver.owner field should be set to the module owner of this driver.
*
*/
struct usb_serial_driver {
struct module *owner;
char *name;
char *short_name;
const struct usb_device_id *id_table;
......
......@@ -312,7 +312,9 @@ static struct usb_driver visor_driver = {
/* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */
static struct usb_serial_driver handspring_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Handspring Visor / Palm OS",
.short_name = "visor",
.id_table = id_table,
......@@ -340,7 +342,9 @@ static struct usb_serial_driver handspring_device = {
/* All of the device info needed for the Clie UX50, TH55 Palm 5.0 devices */
static struct usb_serial_driver clie_5_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Sony Clie 5.0",
.short_name = "clie_5",
.id_table = clie_id_5_table,
......@@ -368,7 +372,9 @@ static struct usb_serial_driver clie_5_device = {
/* device info for the Sony Clie OS version 3.5 */
static struct usb_serial_driver clie_3_5_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Sony Clie 3.5",
.short_name = "clie_3.5",
.id_table = clie_id_3_5_table,
......
......@@ -157,7 +157,9 @@ static void whiteheat_read_callback (struct urb *urb, struct pt_regs *regs);
static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs);
static struct usb_serial_driver whiteheat_fake_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Connect Tech - WhiteHEAT - (prerenumeration)",
.short_name = "whiteheatnofirm",
.id_table = id_table_prerenumeration,
......@@ -170,7 +172,9 @@ static struct usb_serial_driver whiteheat_fake_device = {
};
static struct usb_serial_driver whiteheat_device = {
.owner = THIS_MODULE,
.driver = {
.owner = THIS_MODULE,
},
.name = "Connect Tech - WhiteHEAT",
.short_name = "whiteheat",
.id_table = id_table_std,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment