linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] usb: typec: Add class for plug alt mode device
@ 2020-12-10 21:16 Prashant Malani
  2020-12-10 21:47 ` Benson Leung
  2020-12-11  8:33 ` Heikki Krogerus
  0 siblings, 2 replies; 3+ messages in thread
From: Prashant Malani @ 2020-12-10 21:16 UTC (permalink / raw)
  To: linux-usb, gregkh, heikki.krogerus; +Cc: bleung, Prashant Malani, open list

Add the Type C class for plug alternate mode devices which are being
registered by the Type C connector class. This ensures that udev events
get generated when the plug alt modes are registered.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---

Changes in v2:
- Changed code to set the class member instead of bus.
- Removed the alteration to typec_bus.rst since it's not longer
  required.
- Updated the commit message and subject to reflect the change in code.

v1: https://lore.kernel.org/linux-usb/20201203030846.51669-1-pmalani@chromium.org/

 drivers/usb/typec/class.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 35eec707cb51..29d05b45cc9d 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -482,6 +482,10 @@ typec_register_altmode(struct device *parent,
 	if (is_typec_partner(parent))
 		alt->adev.dev.bus = &typec_bus;
 
+	/* Plug alt modes need a class to generate udev events. */
+	if (is_typec_plug(parent))
+		alt->adev.dev.class = typec_class;
+
 	ret = device_register(&alt->adev.dev);
 	if (ret) {
 		dev_err(parent, "failed to register alternate mode (%d)\n",
-- 
2.29.2.576.ga3fc446d84-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] usb: typec: Add class for plug alt mode device
  2020-12-10 21:16 [PATCH v2] usb: typec: Add class for plug alt mode device Prashant Malani
@ 2020-12-10 21:47 ` Benson Leung
  2020-12-11  8:33 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Benson Leung @ 2020-12-10 21:47 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-usb, gregkh, heikki.krogerus, bleung, open list

[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]

Hi Prashant,

On Thu, Dec 10, 2020 at 01:16:54PM -0800, Prashant Malani wrote:
> Add the Type C class for plug alternate mode devices which are being
> registered by the Type C connector class. This ensures that udev events
> get generated when the plug alt modes are registered.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Reviewed-by: Benson Leung <bleung@chromium.org>


> ---
> 
> Changes in v2:
> - Changed code to set the class member instead of bus.
> - Removed the alteration to typec_bus.rst since it's not longer
>   required.
> - Updated the commit message and subject to reflect the change in code.
> 
> v1: https://lore.kernel.org/linux-usb/20201203030846.51669-1-pmalani@chromium.org/
> 
>  drivers/usb/typec/class.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 35eec707cb51..29d05b45cc9d 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -482,6 +482,10 @@ typec_register_altmode(struct device *parent,
>  	if (is_typec_partner(parent))
>  		alt->adev.dev.bus = &typec_bus;
>  
> +	/* Plug alt modes need a class to generate udev events. */
> +	if (is_typec_plug(parent))
> +		alt->adev.dev.class = typec_class;
> +
>  	ret = device_register(&alt->adev.dev);
>  	if (ret) {
>  		dev_err(parent, "failed to register alternate mode (%d)\n",
> -- 
> 2.29.2.576.ga3fc446d84-goog
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] usb: typec: Add class for plug alt mode device
  2020-12-10 21:16 [PATCH v2] usb: typec: Add class for plug alt mode device Prashant Malani
  2020-12-10 21:47 ` Benson Leung
@ 2020-12-11  8:33 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2020-12-11  8:33 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-usb, gregkh, bleung, open list

On Thu, Dec 10, 2020 at 01:16:54PM -0800, Prashant Malani wrote:
> Add the Type C class for plug alternate mode devices which are being
> registered by the Type C connector class. This ensures that udev events
> get generated when the plug alt modes are registered.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> Changes in v2:
> - Changed code to set the class member instead of bus.
> - Removed the alteration to typec_bus.rst since it's not longer
>   required.
> - Updated the commit message and subject to reflect the change in code.
> 
> v1: https://lore.kernel.org/linux-usb/20201203030846.51669-1-pmalani@chromium.org/
> 
>  drivers/usb/typec/class.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 35eec707cb51..29d05b45cc9d 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -482,6 +482,10 @@ typec_register_altmode(struct device *parent,
>  	if (is_typec_partner(parent))
>  		alt->adev.dev.bus = &typec_bus;
>  
> +	/* Plug alt modes need a class to generate udev events. */
> +	if (is_typec_plug(parent))
> +		alt->adev.dev.class = typec_class;
> +
>  	ret = device_register(&alt->adev.dev);
>  	if (ret) {
>  		dev_err(parent, "failed to register alternate mode (%d)\n",
> -- 
> 2.29.2.576.ga3fc446d84-goog

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-11  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10 21:16 [PATCH v2] usb: typec: Add class for plug alt mode device Prashant Malani
2020-12-10 21:47 ` Benson Leung
2020-12-11  8:33 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).