Commit 2d3dd618 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: cleanup of st5481

you are using __devinit which must not be used with USB drivers,
in addition you are using some false GFP values and fail to check
some error codes.

  - check for unlink due to removal of controller
  - correct GFP values
  - no __devinit in USB
parent 1e9a5829
...@@ -119,7 +119,7 @@ static void usb_b_out(struct st5481_bcs *bcs,int buf_nr) ...@@ -119,7 +119,7 @@ static void usb_b_out(struct st5481_bcs *bcs,int buf_nr)
DBG_ISO_PACKET(0x200,urb); DBG_ISO_PACKET(0x200,urb);
SUBMIT_URB(urb, GFP_KERNEL); SUBMIT_URB(urb, GFP_NOIO);
} }
/* /*
...@@ -171,8 +171,8 @@ static void usb_b_out_complete(struct urb *urb, struct pt_regs *regs) ...@@ -171,8 +171,8 @@ static void usb_b_out_complete(struct urb *urb, struct pt_regs *regs)
buf_nr = get_buf_nr(b_out->urb, urb); buf_nr = get_buf_nr(b_out->urb, urb);
test_and_clear_bit(buf_nr, &b_out->busy); test_and_clear_bit(buf_nr, &b_out->busy);
if (urb->status < 0) { if (unlikely(urb->status < 0)) {
if (urb->status != -ENOENT) { if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) {
WARN("urb status %d",urb->status); WARN("urb status %d",urb->status);
if (b_out->busy == 0) { if (b_out->busy == 0) {
st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL); st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL);
......
...@@ -381,8 +381,8 @@ static void usb_d_out_complete(struct urb *urb, struct pt_regs *regs) ...@@ -381,8 +381,8 @@ static void usb_d_out_complete(struct urb *urb, struct pt_regs *regs)
buf_nr = get_buf_nr(d_out->urb, urb); buf_nr = get_buf_nr(d_out->urb, urb);
test_and_clear_bit(buf_nr, &d_out->busy); test_and_clear_bit(buf_nr, &d_out->busy);
if (urb->status < 0) { if (unlikely(urb->status < 0)) {
if (urb->status != -ENOENT) { if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) {
WARN("urb status %d",urb->status); WARN("urb status %d",urb->status);
if (d_out->busy == 0) { if (d_out->busy == 0) {
st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter); st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter);
...@@ -649,7 +649,7 @@ static void ph_disconnect(struct st5481_adapter *adapter) ...@@ -649,7 +649,7 @@ static void ph_disconnect(struct st5481_adapter *adapter)
st5481_usb_device_ctrl_msg(adapter, GPIO_OUT, adapter->leds, NULL, NULL); st5481_usb_device_ctrl_msg(adapter, GPIO_OUT, adapter->leds, NULL, NULL);
} }
static int __devinit st5481_setup_d_out(struct st5481_adapter *adapter) static int st5481_setup_d_out(struct st5481_adapter *adapter)
{ {
struct usb_device *dev = adapter->usb_dev; struct usb_device *dev = adapter->usb_dev;
struct usb_host_interface *altsetting; struct usb_host_interface *altsetting;
...@@ -682,7 +682,7 @@ static void st5481_release_d_out(struct st5481_adapter *adapter) ...@@ -682,7 +682,7 @@ static void st5481_release_d_out(struct st5481_adapter *adapter)
st5481_release_isocpipes(d_out->urb); st5481_release_isocpipes(d_out->urb);
} }
int __devinit st5481_setup_d(struct st5481_adapter *adapter) int st5481_setup_d(struct st5481_adapter *adapter)
{ {
int retval; int retval;
......
...@@ -58,7 +58,7 @@ static LIST_HEAD(adapter_list); ...@@ -58,7 +58,7 @@ static LIST_HEAD(adapter_list);
* This function will be called when the adapter is plugged * This function will be called when the adapter is plugged
* into the USB bus. * into the USB bus.
*/ */
static int __devinit probe_st5481(struct usb_interface *intf, static int probe_st5481(struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct usb_device *dev = interface_to_usbdev(intf); struct usb_device *dev = interface_to_usbdev(intf);
......
...@@ -48,7 +48,7 @@ static void usb_next_ctrl_msg(struct urb *urb, ...@@ -48,7 +48,7 @@ static void usb_next_ctrl_msg(struct urb *urb,
// Prepare the URB // Prepare the URB
urb->dev = adapter->usb_dev; urb->dev = adapter->usb_dev;
SUBMIT_URB(urb, GFP_KERNEL); SUBMIT_URB(urb, GFP_ATOMIC);
} }
/* /*
...@@ -129,8 +129,8 @@ static void usb_ctrl_complete(struct urb *urb, struct pt_regs *regs) ...@@ -129,8 +129,8 @@ static void usb_ctrl_complete(struct urb *urb, struct pt_regs *regs)
struct st5481_ctrl *ctrl = &adapter->ctrl; struct st5481_ctrl *ctrl = &adapter->ctrl;
struct ctrl_msg *ctrl_msg; struct ctrl_msg *ctrl_msg;
if (urb->status < 0) { if (unlikely(urb->status < 0)) {
if (urb->status != -ENOENT) { if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) {
WARN("urb status %d",urb->status); WARN("urb status %d",urb->status);
} else { } else {
DBG(1,"urb killed"); DBG(1,"urb killed");
...@@ -239,7 +239,7 @@ static void usb_int_complete(struct urb *urb, struct pt_regs *regs) ...@@ -239,7 +239,7 @@ static void usb_int_complete(struct urb *urb, struct pt_regs *regs)
* initialization * initialization
*/ */
int __devinit st5481_setup_usb(struct st5481_adapter *adapter) int (struct st5481_adapter *adapter)
{ {
struct usb_device *dev = adapter->usb_dev; struct usb_device *dev = adapter->usb_dev;
struct st5481_ctrl *ctrl = &adapter->ctrl; struct st5481_ctrl *ctrl = &adapter->ctrl;
...@@ -341,7 +341,7 @@ void st5481_release_usb(struct st5481_adapter *adapter) ...@@ -341,7 +341,7 @@ void st5481_release_usb(struct st5481_adapter *adapter)
/* /*
* Initialize the adapter. * Initialize the adapter.
*/ */
void __devinit st5481_start(struct st5481_adapter *adapter) void st5481_start(struct st5481_adapter *adapter)
{ {
static const u8 init_cmd_table[]={ static const u8 init_cmd_table[]={
SET_DEFAULT,0, SET_DEFAULT,0,
...@@ -381,7 +381,7 @@ void __devinit st5481_start(struct st5481_adapter *adapter) ...@@ -381,7 +381,7 @@ void __devinit st5481_start(struct st5481_adapter *adapter)
/* /*
* Reset the adapter to default values. * Reset the adapter to default values.
*/ */
void __devexit st5481_stop(struct st5481_adapter *adapter) void st5481_stop(struct st5481_adapter *adapter)
{ {
DBG(8,""); DBG(8,"");
...@@ -392,7 +392,7 @@ void __devexit st5481_stop(struct st5481_adapter *adapter) ...@@ -392,7 +392,7 @@ void __devexit st5481_stop(struct st5481_adapter *adapter)
* isochronous USB helpers * isochronous USB helpers
*/ */
static void __devinit static void
fill_isoc_urb(struct urb *urb, struct usb_device *dev, fill_isoc_urb(struct urb *urb, struct usb_device *dev,
unsigned int pipe, void *buf, int num_packets, unsigned int pipe, void *buf, int num_packets,
int packet_size, usb_complete_t complete, int packet_size, usb_complete_t complete,
...@@ -417,7 +417,7 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, ...@@ -417,7 +417,7 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev,
} }
} }
int __devinit int
st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev, st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev,
unsigned int pipe, int num_packets, unsigned int pipe, int num_packets,
int packet_size, int buf_size, int packet_size, int buf_size,
...@@ -481,8 +481,8 @@ static void usb_in_complete(struct urb *urb, struct pt_regs *regs) ...@@ -481,8 +481,8 @@ static void usb_in_complete(struct urb *urb, struct pt_regs *regs)
struct sk_buff *skb; struct sk_buff *skb;
int len, count, status; int len, count, status;
if (urb->status < 0) { if (unlikely(urb->status < 0)) {
if (urb->status != -ENOENT) { if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) {
WARN("urb status %d",urb->status); WARN("urb status %d",urb->status);
} else { } else {
DBG(1,"urb killed"); DBG(1,"urb killed");
...@@ -529,10 +529,10 @@ static void usb_in_complete(struct urb *urb, struct pt_regs *regs) ...@@ -529,10 +529,10 @@ static void usb_in_complete(struct urb *urb, struct pt_regs *regs)
urb->dev = in->adapter->usb_dev; urb->dev = in->adapter->usb_dev;
urb->actual_length = 0; urb->actual_length = 0;
SUBMIT_URB(urb, GFP_KERNEL); SUBMIT_URB(urb, GFP_ATOMIC);
} }
int __devinit st5481_setup_in(struct st5481_in *in) int st5481_setup_in(struct st5481_in *in)
{ {
struct usb_device *dev = in->adapter->usb_dev; struct usb_device *dev = in->adapter->usb_dev;
int retval; int retval;
......
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