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 17e36952bce..2ea657be14c 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)  static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode)  {  	int result; -	US_DEBUGP("SWIMS: %s", "DEVICE MODE SWITCH\n"); +	dev_dbg(&udev->dev, "SWIMS: %s", "DEVICE MODE SWITCH\n");  	result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),  			SWIMS_USB_REQUEST_SetSwocMode,	/* __u8 request      */  			USB_TYPE_VENDOR | USB_DIR_OUT,	/* __u8 request type */ @@ -65,7 +65,7 @@ static int sierra_get_swoc_info(struct usb_device *udev,  {  	int result; -	US_DEBUGP("SWIMS: Attempting to get TRU-Install info.\n"); +	dev_dbg(&udev->dev, "SWIMS: Attempting to get TRU-Install info\n");  	result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),  			SWIMS_USB_REQUEST_GetSwocInfo,	/* __u8 request      */ @@ -81,11 +81,11 @@ static int sierra_get_swoc_info(struct usb_device *udev,  	return result;  } -static void debug_swoc(struct swoc_info *swocInfo) +static void debug_swoc(const struct device *dev, struct swoc_info *swocInfo)  { -	US_DEBUGP("SWIMS: SWoC Rev: %02d \n", swocInfo->rev); -	US_DEBUGP("SWIMS: Linux SKU: %04X \n", swocInfo->LinuxSKU); -	US_DEBUGP("SWIMS: Linux Version: %04X \n", swocInfo->LinuxVer); +	dev_dbg(dev, "SWIMS: SWoC Rev: %02d\n", swocInfo->rev); +	dev_dbg(dev, "SWIMS: Linux SKU: %04X\n", swocInfo->LinuxSKU); +	dev_dbg(dev, "SWIMS: Linux Version: %04X\n", swocInfo->LinuxVer);  } @@ -101,18 +101,17 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr,  	} else {  		swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL);  		if (!swocInfo) { -			US_DEBUGP("SWIMS: Allocation failure\n");  			snprintf(buf, PAGE_SIZE, "Error\n");  			return -ENOMEM;  		}  		result = sierra_get_swoc_info(udev, swocInfo);  		if (result < 0) { -			US_DEBUGP("SWIMS: failed SWoC query\n"); +			dev_dbg(dev, "SWIMS: failed SWoC query\n");  			kfree(swocInfo);  			snprintf(buf, PAGE_SIZE, "Error\n");  			return -EIO;  		} -		debug_swoc(swocInfo); +		debug_swoc(dev, swocInfo);  		result = snprintf(buf, PAGE_SIZE,  			"REV=%02d SKU=%04X VER=%04X\n",  			swocInfo->rev, @@ -138,61 +137,55 @@ int sierra_ms_init(struct us_data *us)  	sh = us_to_host(us);  	scsi_get_host_dev(sh); -	US_DEBUGP("SWIMS: sierra_ms_init called\n"); -  	/* Force Modem mode */  	if (swi_tru_install == TRU_FORCE_MODEM) { -		US_DEBUGP("SWIMS: %s", "Forcing Modem Mode\n"); +		usb_stor_dbg(us, "SWIMS: Forcing Modem Mode\n");  		result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);  		if (result < 0) -			US_DEBUGP("SWIMS: Failed to switch to modem mode.\n"); +			usb_stor_dbg(us, "SWIMS: Failed to switch to modem mode\n");  		return -EIO;  	}  	/* Force Mass Storage mode (keep CD-Rom) */  	else if (swi_tru_install == TRU_FORCE_MS) { -		US_DEBUGP("SWIMS: %s", "Forcing Mass Storage Mode\n"); +		usb_stor_dbg(us, "SWIMS: Forcing Mass Storage Mode\n");  		goto complete;  	}  	/* Normal TRU-Install Logic */  	else { -		US_DEBUGP("SWIMS: %s", "Normal SWoC Logic\n"); +		usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n");  		swocInfo = kmalloc(sizeof(struct swoc_info),  				GFP_KERNEL); -		if (!swocInfo) { -			US_DEBUGP("SWIMS: %s", "Allocation failure\n"); +		if (!swocInfo)  			return -ENOMEM; -		}  		retries = 3;  		do {  			retries--;  			result = sierra_get_swoc_info(udev, swocInfo);  			if (result < 0) { -				US_DEBUGP("SWIMS: %s", "Failed SWoC query\n"); +				usb_stor_dbg(us, "SWIMS: Failed SWoC query\n");  				schedule_timeout_uninterruptible(2*HZ);  			}  		} while (retries && result < 0);  		if (result < 0) { -			US_DEBUGP("SWIMS: %s", -				  "Completely failed SWoC query\n"); +			usb_stor_dbg(us, "SWIMS: Completely failed SWoC query\n");  			kfree(swocInfo);  			return -EIO;  		} -		debug_swoc(swocInfo); +		debug_swoc(&us->pusb_dev->dev, swocInfo);  		/* If there is not Linux software on the TRU-Install device  		 * then switch to modem mode  		 */  		if (!containsFullLinuxPackage(swocInfo)) { -			US_DEBUGP("SWIMS: %s", -				"Switching to Modem Mode\n"); +			usb_stor_dbg(us, "SWIMS: Switching to Modem Mode\n");  			result = sierra_set_ms_mode(udev,  				SWIMS_SET_MODE_Modem);  			if (result < 0) -				US_DEBUGP("SWIMS: Failed to switch modem\n"); +				usb_stor_dbg(us, "SWIMS: Failed to switch modem\n");  			kfree(swocInfo);  			return -EIO;  		}  |