Re: [PATCH] USB: remove dead code from suspend/resume path

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

 



On Mon, 2 Jan 2012, Oliver Neukum wrote:

> From 5c7c47ef41f62693dd071f9c23770a9ce191b884 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oliver@xxxxxxxxxx>
> Date: Mon, 2 Jan 2012 15:11:48 +0100
> Subject: [PATCH] USB: remove dead code from suspend/resume path
> 
> If a driver does not support the suspend/resume callbacks
> it will be forcibly disconnected. There is no reason to check
> for support of the callbacks after that.
> 
> Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
> ---
>  drivers/usb/core/driver.c |   28 +++++++---------------------
>  1 files changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index 45887a0..07f8718 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -1073,17 +1073,10 @@ static int usb_suspend_interface(struct usb_device *udev,
>  		goto done;
>  	driver = to_usb_driver(intf->dev.driver);
>  
> -	if (driver->suspend) {
> -		status = driver->suspend(intf, msg);
> -		if (status && !PMSG_IS_AUTO(msg))
> -			dev_err(&intf->dev, "%s error %d\n",
> -					"suspend", status);
> -	} else {
> -		/* Later we will unbind the driver and reprobe */
> -		intf->needs_binding = 1;
> -		dev_warn(&intf->dev, "no %s for driver %s?\n",
> -				"suspend", driver->name);
> -	}
> +	/* at this time we know the driver supports suspend */
> +	status = driver->suspend(intf, msg);
> +	if (status && !PMSG_IS_AUTO(msg))
> +		dev_err(&intf->dev, "suspend error %d\n", status);
>  
>   done:
>  	dev_vdbg(&intf->dev, "%s: status %d\n", __func__, status);
> @@ -1132,16 +1125,9 @@ static int usb_resume_interface(struct usb_device *udev,
>  					"reset_resume", driver->name);
>  		}
>  	} else {
> -		if (driver->resume) {
> -			status = driver->resume(intf);
> -			if (status)
> -				dev_err(&intf->dev, "%s error %d\n",
> -						"resume", status);
> -		} else {
> -			intf->needs_binding = 1;
> -			dev_warn(&intf->dev, "no %s for driver %s?\n",
> -					"resume", driver->name);
> -		}
> +		status = driver->resume(intf);
> +		if (status)
> +			dev_err(&intf->dev, "resume error %d\n", status);
>  	}
>  
>  done:

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

--
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