From: Javier Carrasco <javier.carrasco@wolfvision.net>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Helen Koike <helen.koike@collabora.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Russell King <linux@armlinux.org.uk>,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 7/9] usb: misc: onboard_dev: add support for non-hub devices
Date: Fri, 1 Mar 2024 09:36:37 +0100 [thread overview]
Message-ID: <80e5800e-366d-4f29-80a5-8445ab692e5e@wolfvision.net> (raw)
In-Reply-To: <ZeDgfIojODIbhs6N@google.com>
On 29.02.24 20:52, Matthias Kaehlcke wrote:
> On Thu, Feb 29, 2024 at 09:34:50AM +0100, Javier Carrasco wrote:
>> Most of the functionality this driver provides can be used by non-hub
>> devices as well.
>>
>> To account for the hub-specific code, add a flag to the device data
>> structure and check its value for hub-specific code.
>>
>> The 'always_powered_in_supend' attribute is only available for hub
>> devices, keeping the driver's default behavior for non-hub devices (keep
>> on in suspend).
>>
>> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
>> ---
>> drivers/usb/misc/onboard_usb_dev.c | 25 ++++++++++++++++++++++++-
>> drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++
>> 2 files changed, 34 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
>> index 4ae580445408..f1b174503c44 100644
>> --- a/drivers/usb/misc/onboard_usb_dev.c
>> +++ b/drivers/usb/misc/onboard_usb_dev.c
>> @@ -261,7 +261,27 @@ static struct attribute *onboard_dev_attrs[] = {
>> &dev_attr_always_powered_in_suspend.attr,
>> NULL,
>> };
>> -ATTRIBUTE_GROUPS(onboard_dev);
>> +
>> +static umode_t onboard_dev_attrs_are_visible(struct kobject *kobj,
>> + struct attribute *attr,
>> + int n)
>> +{
>> + struct device *dev = kobj_to_dev(kobj);
>> + struct onboard_dev *onboard_dev = dev_get_drvdata(dev);
>> +
>> + if (attr == &dev_attr_always_powered_in_suspend.attr &&
>> + !onboard_dev->pdata->is_hub)
>> + return 0;
>> +
>> + return attr->mode;
>> +}
>> +
>> +static const struct attribute_group onboard_dev_group = {
>> + .is_visible = onboard_dev_attrs_are_visible,
>> + .attrs = onboard_dev_attrs,
>> +};
>> +__ATTRIBUTE_GROUPS(onboard_dev);
>> +
>
> nit: remove one empty line
>
>>
>> static void onboard_dev_attach_usb_driver(struct work_struct *work)
>> {
>> @@ -286,6 +306,9 @@ static int onboard_dev_probe(struct platform_device *pdev)
>> if (!onboard_dev->pdata)
>> return -EINVAL;
>>
>> + if (!onboard_dev->pdata->is_hub)
>> + onboard_dev->always_powered_in_suspend = true;
>> +
>> onboard_dev->dev = dev;
>>
>> err = onboard_dev_get_regulators(onboard_dev);
>> diff --git a/drivers/usb/misc/onboard_usb_dev.h b/drivers/usb/misc/onboard_usb_dev.h
>> index 4da9f3b7f9e9..58cf8c81b2cf 100644
>> --- a/drivers/usb/misc/onboard_usb_dev.h
>> +++ b/drivers/usb/misc/onboard_usb_dev.h
>> @@ -12,60 +12,70 @@ struct onboard_dev_pdata {
>> unsigned long reset_us; /* reset pulse width in us */
>> unsigned int num_supplies; /* number of supplies */
>> const char * const supply_names[MAX_SUPPLIES];
>> + bool is_hub; /* true if the device is a HUB */
>
> nit: either drop the comment (the variable name is pretty self explaining),
> or s/HUB/hub/ ('hub' isn't an acronym).
>
> Acked-by: Matthias Kaehlcke <mka@chromium.org>
To be honest, I added the description to follow the same pattern used
for the previous fields:
unsigned long reset_us; /* reset pulse width in us */
unsigned int num_supplies; /* number of supplies */
Best regards,
Javier Carrasco
next prev parent reply other threads:[~2024-03-01 8:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 8:34 [PATCH v6 0/9] usb: misc: onboard_hub: add support for XMOS XVF3500 Javier Carrasco
2024-02-29 8:34 ` [PATCH v6 1/9] usb: misc: onboard_hub: use pointer consistently in the probe function Javier Carrasco
2024-02-29 16:18 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 2/9] usb: misc: onboard_hub: use device supply names Javier Carrasco
2024-02-29 16:20 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 3/9] usb: misc: onboard_hub: rename to onboard_dev Javier Carrasco
2024-02-29 19:39 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 4/9] drm: ci: arm64.config: update ONBOARD_USB_HUB to ONBOARD_USB_DEV Javier Carrasco
2024-02-29 19:42 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 5/9] arm64: defconfig: " Javier Carrasco
2024-02-29 19:43 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 6/9] ARM: multi_v7_defconfig: update ONBOARD_USB_HUB to ONBOAD_USB_DEV Javier Carrasco
2024-02-29 19:43 ` Matthias Kaehlcke
2024-02-29 8:34 ` [PATCH v6 7/9] usb: misc: onboard_dev: add support for non-hub devices Javier Carrasco
2024-02-29 19:52 ` Matthias Kaehlcke
2024-03-01 8:36 ` Javier Carrasco [this message]
2024-02-29 8:34 ` [PATCH v6 8/9] ASoC: dt-bindings: xmos,xvf3500: add XMOS XVF3500 voice processor Javier Carrasco
2024-02-29 8:34 ` [PATCH v6 9/9] usb: misc: onboard_dev: add support for XMOS XVF3500 Javier Carrasco
2024-02-29 19:54 ` Matthias Kaehlcke
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=80e5800e-366d-4f29-80a5-8445ab692e5e@wolfvision.net \
--to=javier.carrasco@wolfvision.net \
--cc=airlied@gmail.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=helen.koike@collabora.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mka@chromium.org \
--cc=mripard@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tzimmermann@suse.de \
--cc=will@kernel.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
all inboxes | Powered by JetHome®