diff options
Diffstat (limited to 'drivers/usb/storage/sierra_ms.c')
-rw-r--r-- | drivers/usb/storage/sierra_ms.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 17e36952bced..2ea657be14c8 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c | |||
@@ -47,7 +47,7 @@ static bool containsFullLinuxPackage(struct swoc_info *swocInfo) | |||
47 | static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode) | 47 | static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode) |
48 | { | 48 | { |
49 | int result; | 49 | int result; |
50 | US_DEBUGP("SWIMS: %s", "DEVICE MODE SWITCH\n"); | 50 | dev_dbg(&udev->dev, "SWIMS: %s", "DEVICE MODE SWITCH\n"); |
51 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 51 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
52 | SWIMS_USB_REQUEST_SetSwocMode, /* __u8 request */ | 52 | SWIMS_USB_REQUEST_SetSwocMode, /* __u8 request */ |
53 | USB_TYPE_VENDOR | USB_DIR_OUT, /* __u8 request type */ | 53 | USB_TYPE_VENDOR | USB_DIR_OUT, /* __u8 request type */ |
@@ -65,7 +65,7 @@ static int sierra_get_swoc_info(struct usb_device *udev, | |||
65 | { | 65 | { |
66 | int result; | 66 | int result; |
67 | 67 | ||
68 | US_DEBUGP("SWIMS: Attempting to get TRU-Install info.\n"); | 68 | dev_dbg(&udev->dev, "SWIMS: Attempting to get TRU-Install info\n"); |
69 | 69 | ||
70 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 70 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
71 | SWIMS_USB_REQUEST_GetSwocInfo, /* __u8 request */ | 71 | SWIMS_USB_REQUEST_GetSwocInfo, /* __u8 request */ |
@@ -81,11 +81,11 @@ static int sierra_get_swoc_info(struct usb_device *udev, | |||
81 | return result; | 81 | return result; |
82 | } | 82 | } |
83 | 83 | ||
84 | static void debug_swoc(struct swoc_info *swocInfo) | 84 | static void debug_swoc(const struct device *dev, struct swoc_info *swocInfo) |
85 | { | 85 | { |
86 | US_DEBUGP("SWIMS: SWoC Rev: %02d \n", swocInfo->rev); | 86 | dev_dbg(dev, "SWIMS: SWoC Rev: %02d\n", swocInfo->rev); |
87 | US_DEBUGP("SWIMS: Linux SKU: %04X \n", swocInfo->LinuxSKU); | 87 | dev_dbg(dev, "SWIMS: Linux SKU: %04X\n", swocInfo->LinuxSKU); |
88 | US_DEBUGP("SWIMS: Linux Version: %04X \n", swocInfo->LinuxVer); | 88 | dev_dbg(dev, "SWIMS: Linux Version: %04X\n", swocInfo->LinuxVer); |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
@@ -101,18 +101,17 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, | |||
101 | } else { | 101 | } else { |
102 | swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL); | 102 | swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL); |
103 | if (!swocInfo) { | 103 | if (!swocInfo) { |
104 | US_DEBUGP("SWIMS: Allocation failure\n"); | ||
105 | snprintf(buf, PAGE_SIZE, "Error\n"); | 104 | snprintf(buf, PAGE_SIZE, "Error\n"); |
106 | return -ENOMEM; | 105 | return -ENOMEM; |
107 | } | 106 | } |
108 | result = sierra_get_swoc_info(udev, swocInfo); | 107 | result = sierra_get_swoc_info(udev, swocInfo); |
109 | if (result < 0) { | 108 | if (result < 0) { |
110 | US_DEBUGP("SWIMS: failed SWoC query\n"); | 109 | dev_dbg(dev, "SWIMS: failed SWoC query\n"); |
111 | kfree(swocInfo); | 110 | kfree(swocInfo); |
112 | snprintf(buf, PAGE_SIZE, "Error\n"); | 111 | snprintf(buf, PAGE_SIZE, "Error\n"); |
113 | return -EIO; | 112 | return -EIO; |
114 | } | 113 | } |
115 | debug_swoc(swocInfo); | 114 | debug_swoc(dev, swocInfo); |
116 | result = snprintf(buf, PAGE_SIZE, | 115 | result = snprintf(buf, PAGE_SIZE, |
117 | "REV=%02d SKU=%04X VER=%04X\n", | 116 | "REV=%02d SKU=%04X VER=%04X\n", |
118 | swocInfo->rev, | 117 | swocInfo->rev, |
@@ -138,61 +137,55 @@ int sierra_ms_init(struct us_data *us) | |||
138 | sh = us_to_host(us); | 137 | sh = us_to_host(us); |
139 | scsi_get_host_dev(sh); | 138 | scsi_get_host_dev(sh); |
140 | 139 | ||
141 | US_DEBUGP("SWIMS: sierra_ms_init called\n"); | ||
142 | |||
143 | /* Force Modem mode */ | 140 | /* Force Modem mode */ |
144 | if (swi_tru_install == TRU_FORCE_MODEM) { | 141 | if (swi_tru_install == TRU_FORCE_MODEM) { |
145 | US_DEBUGP("SWIMS: %s", "Forcing Modem Mode\n"); | 142 | usb_stor_dbg(us, "SWIMS: Forcing Modem Mode\n"); |
146 | result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem); | 143 | result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem); |
147 | if (result < 0) | 144 | if (result < 0) |
148 | US_DEBUGP("SWIMS: Failed to switch to modem mode.\n"); | 145 | usb_stor_dbg(us, "SWIMS: Failed to switch to modem mode\n"); |
149 | return -EIO; | 146 | return -EIO; |
150 | } | 147 | } |
151 | /* Force Mass Storage mode (keep CD-Rom) */ | 148 | /* Force Mass Storage mode (keep CD-Rom) */ |
152 | else if (swi_tru_install == TRU_FORCE_MS) { | 149 | else if (swi_tru_install == TRU_FORCE_MS) { |
153 | US_DEBUGP("SWIMS: %s", "Forcing Mass Storage Mode\n"); | 150 | usb_stor_dbg(us, "SWIMS: Forcing Mass Storage Mode\n"); |
154 | goto complete; | 151 | goto complete; |
155 | } | 152 | } |
156 | /* Normal TRU-Install Logic */ | 153 | /* Normal TRU-Install Logic */ |
157 | else { | 154 | else { |
158 | US_DEBUGP("SWIMS: %s", "Normal SWoC Logic\n"); | 155 | usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n"); |
159 | 156 | ||
160 | swocInfo = kmalloc(sizeof(struct swoc_info), | 157 | swocInfo = kmalloc(sizeof(struct swoc_info), |
161 | GFP_KERNEL); | 158 | GFP_KERNEL); |
162 | if (!swocInfo) { | 159 | if (!swocInfo) |
163 | US_DEBUGP("SWIMS: %s", "Allocation failure\n"); | ||
164 | return -ENOMEM; | 160 | return -ENOMEM; |
165 | } | ||
166 | 161 | ||
167 | retries = 3; | 162 | retries = 3; |
168 | do { | 163 | do { |
169 | retries--; | 164 | retries--; |
170 | result = sierra_get_swoc_info(udev, swocInfo); | 165 | result = sierra_get_swoc_info(udev, swocInfo); |
171 | if (result < 0) { | 166 | if (result < 0) { |
172 | US_DEBUGP("SWIMS: %s", "Failed SWoC query\n"); | 167 | usb_stor_dbg(us, "SWIMS: Failed SWoC query\n"); |
173 | schedule_timeout_uninterruptible(2*HZ); | 168 | schedule_timeout_uninterruptible(2*HZ); |
174 | } | 169 | } |
175 | } while (retries && result < 0); | 170 | } while (retries && result < 0); |
176 | 171 | ||
177 | if (result < 0) { | 172 | if (result < 0) { |
178 | US_DEBUGP("SWIMS: %s", | 173 | usb_stor_dbg(us, "SWIMS: Completely failed SWoC query\n"); |
179 | "Completely failed SWoC query\n"); | ||
180 | kfree(swocInfo); | 174 | kfree(swocInfo); |
181 | return -EIO; | 175 | return -EIO; |
182 | } | 176 | } |
183 | 177 | ||
184 | debug_swoc(swocInfo); | 178 | debug_swoc(&us->pusb_dev->dev, swocInfo); |
185 | 179 | ||
186 | /* If there is not Linux software on the TRU-Install device | 180 | /* If there is not Linux software on the TRU-Install device |
187 | * then switch to modem mode | 181 | * then switch to modem mode |
188 | */ | 182 | */ |
189 | if (!containsFullLinuxPackage(swocInfo)) { | 183 | if (!containsFullLinuxPackage(swocInfo)) { |
190 | US_DEBUGP("SWIMS: %s", | 184 | usb_stor_dbg(us, "SWIMS: Switching to Modem Mode\n"); |
191 | "Switching to Modem Mode\n"); | ||
192 | result = sierra_set_ms_mode(udev, | 185 | result = sierra_set_ms_mode(udev, |
193 | SWIMS_SET_MODE_Modem); | 186 | SWIMS_SET_MODE_Modem); |
194 | if (result < 0) | 187 | if (result < 0) |
195 | US_DEBUGP("SWIMS: Failed to switch modem\n"); | 188 | usb_stor_dbg(us, "SWIMS: Failed to switch modem\n"); |
196 | kfree(swocInfo); | 189 | kfree(swocInfo); |
197 | return -EIO; | 190 | return -EIO; |
198 | } | 191 | } |