From: Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
To: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org,
rjw-KKrjLPT3xs0@public.gmane.org,
oneukum-l3A5Bk7waGM@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 2/8] usb: Register usb port's acpi power resources
Date: Mon, 21 Jan 2013 13:20:57 -0800 [thread overview]
Message-ID: <20130121212056.GA14908@kroah.com> (raw)
In-Reply-To: <1358777887-2656-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On Mon, Jan 21, 2013 at 10:18:01PM +0800, Lan Tianyu wrote:
> This patch is to register usb port's acpi power resources. Create
> link between usb port device and its acpi power resource.
>
> Acked-by: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
> Signed-off-by: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/usb/core/port.c | 3 +++
> drivers/usb/core/usb-acpi.c | 20 ++++++++++++++++++++
> drivers/usb/core/usb.h | 6 ++++++
> 3 files changed, 29 insertions(+)
>
> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index fe5959f..4dfa254 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -66,6 +66,7 @@ static void usb_port_device_release(struct device *dev)
> {
> struct usb_port *port_dev = to_usb_port(dev);
>
> + usb_acpi_unregister_power_resources(dev);
> kfree(port_dev);
> }
>
> @@ -95,6 +96,8 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
> if (retval)
> goto error_register;
>
> + usb_acpi_register_power_resources(&port_dev->dev);
> +
> return 0;
>
> error_register:
> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index cef4252..558ab01 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c
> @@ -216,6 +216,26 @@ static struct acpi_bus_type usb_acpi_bus = {
> .find_device = usb_acpi_find_device,
> };
>
> +int usb_acpi_register_power_resources(struct device *dev)
> +{
> + acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
> +
> + if (!port_handle)
> + return -ENODEV;
> +
> + if (acpi_power_resource_register_device(dev, port_handle) < 0)
> + return -ENODEV;
> + return 0;
> +}
Why return a value if you never check it? Either properly handle the
error in the place you call this function, or don't have a return value.
I'd prefer you to handle the error properly.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-01-21 21:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 14:17 [PATCH V6 0/8] usb: usb port power off mechanism and expose usb port connect type Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 2/8] usb: Register usb port's acpi power resources Lan Tianyu
[not found] ` <1358777887-2656-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-21 21:20 ` Greg KH [this message]
2013-01-22 3:11 ` Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 3/8] PM/Qos: Expose dev_pm_qos_flags symbol Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 4/8] usb: add runtime pm support for usb port device Lan Tianyu
[not found] ` <1358777887-2656-5-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-21 21:24 ` Greg KH
2013-01-22 3:30 ` Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 6/8] usb: expose usb port's pm qos flags to user space Lan Tianyu
2013-01-21 21:31 ` Greg KH
2013-01-22 13:50 ` Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 7/8] usb: add usb_device_allow_power_off() and usb_device_prevent_power_off() function Lan Tianyu
[not found] ` <1358777887-2656-8-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-21 21:33 ` Greg KH
2013-01-22 13:59 ` Lan Tianyu
2013-01-22 15:09 ` Alan Stern
2013-01-21 21:33 ` Greg KH
[not found] ` <20130121213346.GE20083-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-01-22 14:23 ` Lan Tianyu
[not found] ` <50FEA0D0.6020106-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-22 15:05 ` Greg KH
[not found] ` <1358777887-2656-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-21 14:18 ` [PATCH v6 1/8] USB: Set usb port's DeviceRemovable according acpi information Lan Tianyu
2013-01-21 14:18 ` [PATCH v6 5/8] usb: add usb port auto power off mechanism Lan Tianyu
2013-01-21 21:30 ` Greg KH
2013-01-21 14:18 ` [PATCH v6 8/8] usb: enable usb port device's async suspend Lan Tianyu
[not found] ` <1358777887-2656-9-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-21 21:34 ` Greg KH
[not found] ` <20130121213418.GF20083-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-01-22 14:23 ` Lan Tianyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130121212056.GA14908@kroah.com \
--to=gregkh-hqyy1w1ycw8ekmwlsbkhg0b+6bgklq7r@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oneukum-l3A5Bk7waGM@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox