<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/roles, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-19T15:15:04+00:00</updated>
<entry>
<title>usb: roles: get usb role switch from parent only for usb-b-connector</title>
<updated>2026-03-19T15:15:04+00:00</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2026-03-09T07:43:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c896ebfb7f725e5799731ae408065c62c390f9c'/>
<id>urn:sha1:2c896ebfb7f725e5799731ae408065c62c390f9c</id>
<content type='text'>
commit 8345b1539faa49fcf9c9439c3cbd97dac6eca171 upstream.

usb_role_switch_is_parent() was walking up to the parent node and checking
for the "usb-role-switch" property regardless of the type of the passed
fwnode. This could cause unrelated device nodes to be probed as potential
role switch parent, leading to spurious matches and "-EPROBE_DEFER" being
returned infinitely.

Till now only Type-B connector node will have a parent node which may
present "usb-role-switch" property and register the role switch device.
For Type-C connector node, its parent node will always be a Type-C chip
device which will never register the role switch device. However, it may
still present a non-boolean "usb-role-switch = &lt;&amp;usb_controller&gt;" property
for historical compatibility.

So restrict the helper to only operate on Type-B connector when attempting
to get the role switch from parent node.

Fixes: 6fadd72943b8 ("usb: roles: get usb-role-switch from parent")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Tested-by: Arnaud Ferraris &lt;arnaud.ferraris@collabora.com&gt;
Reviewed-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://patch.msgid.link/20260309074313.2809867-3-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: set switch registered flag early on</title>
<updated>2025-02-14T08:26:25+00:00</updated>
<author>
<name>Elson Roy Serrao</name>
<email>quic_eserrao@quicinc.com</email>
</author>
<published>2025-02-06T19:39:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=634775a752a86784511018a108f3b530cc3399a7'/>
<id>urn:sha1:634775a752a86784511018a108f3b530cc3399a7</id>
<content type='text'>
The role switch registration and set_role() can happen in parallel as they
are invoked independent of each other. There is a possibility that a driver
might spend significant amount of time in usb_role_switch_register() API
due to the presence of time intensive operations like component_add()
which operate under common mutex. This leads to a time window after
allocating the switch and before setting the registered flag where the set
role notifications are dropped. Below timeline summarizes this behavior

Thread1				|	Thread2
usb_role_switch_register()	|
	|			|
	---&gt; allocate switch	|
	|			|
	---&gt; component_add()	|	usb_role_switch_set_role()
	|			|	|
	|			|	--&gt; Drop role notifications
	|			|	    since sw-&gt;registered
	|			|	    flag is not set.
	|			|
	---&gt;Set registered flag.|

To avoid this, set the registered flag early on in the switch register
API.

Fixes: b787a3e78175 ("usb: roles: don't get/set_role() when usb_role_switch is unregistered")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Elson Roy Serrao &lt;quic_eserrao@quicinc.com&gt;
Reviewed-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20250206193950.22421-1-quic_eserrao@quicinc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: Switch back to struct platform_driver::remove()</title>
<updated>2024-10-04T13:13:03+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@baylibre.com</email>
</author>
<published>2024-09-24T08:43:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a0749d61a9a999fd15813a8f7db0a7a2451a657'/>
<id>urn:sha1:9a0749d61a9a999fd15813a8f7db0a7a2451a657</id>
<content type='text'>
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/usb to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@baylibre.com&gt;
Link: https://lore.kernel.org/r/20240924084329.53094-2-u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: Improve the fix for a false positive recursive locking complaint</title>
<updated>2024-09-13T05:36:02+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2024-09-12T22:39:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7d01ef789bdcdd02ac42b98ae5b7f98310a0e3d2'/>
<id>urn:sha1:7d01ef789bdcdd02ac42b98ae5b7f98310a0e3d2</id>
<content type='text'>
Improve commit fc88bb116179 ("usb: roles: add lockdep class key to struct
usb_role_switch") as follows:
* Move the lock class key declaration just above the mutex declaration such
  that the declaration order of these objects matches their initialization
  order.
* Destroy the mutex and lock class key just before these objects are
  freed. This makes it easier to verify that the destruction calls happen
  after the last use of these objects.
* Instead of switching the mutex key to the dynamic lock class key after
  initialization of the mutex has completed, initialize the mutex with the
  dynamic lock class key.

Cc: Amit Sunil Dhamne &lt;amitsd@google.com&gt;
Cc: Badhri Jagan Sridharan &lt;badhri@google.com&gt;
Cc: Hans de Goede &lt;hdegoede@redhat.com&gt;
Cc: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Cc: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20240912223956.3554086-4-bvanassche@acm.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: add lockdep class key to struct usb_role_switch</title>
<updated>2024-08-25T11:45:56+00:00</updated>
<author>
<name>Amit Sunil Dhamne</name>
<email>amitsd@google.com</email>
</author>
<published>2024-08-22T22:37:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fc88bb11617978fb3fcfcc697fd5c9d2dae9c4a3'/>
<id>urn:sha1:fc88bb11617978fb3fcfcc697fd5c9d2dae9c4a3</id>
<content type='text'>
There can be multiple role switch devices running on a platform. Given
that lockdep is not capable of differentiating between locks of
different instances, false positive warnings for circular locking are
reported. To prevent this, register unique lockdep key for each of the
individual instances.

Signed-off-by: Amit Sunil Dhamne &lt;amitsd@google.com&gt;
Reviewed-by: Badhri Jagan Sridharan &lt;badhri@google.com&gt;
Link: https://lore.kernel.org/r/20240822223717.253433-1-amitsd@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge v6.8-rc6 into usb-next</title>
<updated>2024-02-26T05:53:50+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2024-02-26T05:53:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a560a5672826fc1e057068bda93b3d4c98d037a2'/>
<id>urn:sha1:a560a5672826fc1e057068bda93b3d4c98d037a2</id>
<content type='text'>
We need it here for the USB fixes, and it resolves a merge conflict as
reported in linux-next in drivers/usb/roles/class.c

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: don't get/set_role() when usb_role_switch is unregistered</title>
<updated>2024-02-19T08:30:41+00:00</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2024-01-29T09:37:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b787a3e781759026a6212736ef8e52cf83d1821a'/>
<id>urn:sha1:b787a3e781759026a6212736ef8e52cf83d1821a</id>
<content type='text'>
There is a possibility that usb_role_switch device is unregistered before
the user put usb_role_switch. In this case, the user may still want to
get/set_role() since the user can't sense the changes of usb_role_switch.

This will add a flag to show if usb_role_switch is already registered and
avoid unwanted behaviors.

Fixes: fde0aa6c175a ("usb: common: Small class for USB role switches")
cc: stable@vger.kernel.org
Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Acked-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20240129093739.2371530-2-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: fix NULL pointer issue when put module's reference</title>
<updated>2024-02-19T08:30:41+00:00</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2024-01-29T09:37:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1c9be13846c0b2abc2480602f8ef421360e1ad9e'/>
<id>urn:sha1:1c9be13846c0b2abc2480602f8ef421360e1ad9e</id>
<content type='text'>
In current design, usb role class driver will get usb_role_switch parent's
module reference after the user get usb_role_switch device and put the
reference after the user put the usb_role_switch device. However, the
parent device of usb_role_switch may be removed before the user put the
usb_role_switch. If so, then, NULL pointer issue will be met when the user
put the parent module's reference.

This will save the module pointer in structure of usb_role_switch. Then,
we don't need to find module by iterating long relations.

Fixes: 5c54fcac9a9d ("usb: roles: Take care of driver module reference counting")
cc: stable@vger.kernel.org
Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Acked-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20240129093739.2371530-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: roles: Link the switch to its connector</title>
<updated>2024-02-17T16:02:42+00:00</updated>
<author>
<name>Heikki Krogerus</name>
<email>heikki.krogerus@linux.intel.com</email>
</author>
<published>2024-02-13T13:00:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a270ec7bfb0b928ff7c11a4b1f8a026cd20e6b4'/>
<id>urn:sha1:9a270ec7bfb0b928ff7c11a4b1f8a026cd20e6b4</id>
<content type='text'>
This is probable useful information to have in user space in
general, but it's primarily needed for the xHCI DbC (Debug
Capability). When xHCI DbC is being used, the USB port needs
to be muxed to the xHCI even in device role. In xHCI DbC mode,
the xHCI is the USB device controller.

Tested-by: Uday Bhat &lt;uday.m.bhat@intel.com&gt;
Signed-off-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Reviewed-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Link: https://lore.kernel.org/r/20240213130018.3029991-2-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: roles: make role_class a static const structure</title>
<updated>2023-06-20T14:20:40+00:00</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2023-06-20T09:44:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=044a61158b9e00ee4b69bc4fa0f3e720b5dd669a'/>
<id>urn:sha1:044a61158b9e00ee4b69bc4fa0f3e720b5dd669a</id>
<content type='text'>
Now that the driver core allows for struct class to be in read-only
memory, move the role_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Link: https://lore.kernel.org/r/20230620094412.508580-7-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
