Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbe80c9

Browse files
Heikki Krogerusgregkh
Heikki Krogerus
authored andcommitted
usb: typec: altmode: Remove the notification chain
Using the generic notification chain is not reasonable withthe alternate modes because it would require dependenciesbetween the drivers of the components that need thenotifications, and the typec drivers.There are no users for the alternate mode notifications, soremoving the chain and the API for it completely.Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>Link:https://lore.kernel.org/r/20200211112531.86510-6-heikki.krogerus@linux.intel.comSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent684cb4b commitbbe80c9

File tree

5 files changed

+3
-107
lines changed

5 files changed

+3
-107
lines changed

‎Documentation/driver-api/usb/typec_bus.rst‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ in need to reconfigure the pins on the connector, the alternate mode driver
5353
needs to notify the bus using:c:func:`typec_altmode_notify()`. The driver
5454
passes the negotiated SVID specific pin configuration value to the function as
5555
parameter. The bus driver will then configure the mux behind the connector using
56-
that value as the state value for the mux, and also call blocking notification
57-
chain to notify the external drivers about the state of the connector that need
58-
to know it.
56+
that value as the state value for the mux.
5957

6058
NOTE: The SVID specific pin configuration values must always start from
6159
``TYPEC_STATE_MODAL``. USB Type-C specification defines two default states for
@@ -80,19 +78,6 @@ Helper macro ``TYPEC_MODAL_STATE()`` can also be used::
8078
#define ALTMODEX_CONF_A = TYPEC_MODAL_STATE(0);
8179
#define ALTMODEX_CONF_B = TYPEC_MODAL_STATE(1);
8280

83-
Notification chain
84-
~~~~~~~~~~~~~~~~~~
85-
86-
The drivers for the components that the alternate modes are designed for need to
87-
get details regarding the results of the negotiation with the partner, and the
88-
pin configuration of the connector. In case of DisplayPort alternate mode for
89-
example, the GPU drivers will need to know those details. In case of
90-
Thunderbolt alternate mode, the thunderbolt drivers will need to know them, and
91-
so on.
92-
93-
The notification chain is designed for this purpose. The drivers can register
94-
notifiers with:c:func:`typec_altmode_register_notifier()`.
95-
9681
Cable plug alternate modes
9782
~~~~~~~~~~~~~~~~~~~~~~~~~~
9883

@@ -129,8 +114,3 @@ Cable Plug operations
129114

130115
..kernel-doc::drivers/usb/typec/bus.c
131116
:functions: typec_altmode_get_plug typec_altmode_put_plug
132-
133-
Notifications
134-
~~~~~~~~~~~~~
135-
..kernel-doc::drivers/usb/typec/class.c
136-
:functions: typec_altmode_register_notifier typec_altmode_unregister_notifier

‎drivers/usb/typec/bus.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,10 @@ static int typec_altmode_set_state(struct typec_altmode *adev,
3030
{
3131
boolis_port=is_typec_port(adev->dev.parent);
3232
structaltmode*port_altmode;
33-
intret;
3433

3534
port_altmode=is_port ?to_altmode(adev) :to_altmode(adev)->partner;
3635

37-
ret=typec_altmode_set_mux(port_altmode,conf,data);
38-
if (ret)
39-
returnret;
40-
41-
blocking_notifier_call_chain(&port_altmode->nh,conf,NULL);
42-
43-
return0;
36+
returntypec_altmode_set_mux(port_altmode,conf,data);
4437
}
4538

4639
/* -------------------------------------------------------------------------- */
@@ -82,9 +75,6 @@ int typec_altmode_notify(struct typec_altmode *adev,
8275
if (ret)
8376
returnret;
8477

85-
blocking_notifier_call_chain(is_port ?&altmode->nh :&partner->nh,
86-
conf,data);
87-
8878
if (partner->adev.ops&&partner->adev.ops->notify)
8979
returnpartner->adev.ops->notify(&partner->adev,conf,data);
9080

‎drivers/usb/typec/bus.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ struct altmode {
2222

2323
structaltmode*partner;
2424
structaltmode*plug[2];
25-
26-
structblocking_notifier_headnh;
2725
};
2826

2927
#defineto_altmode(d) container_of(d, struct altmode, adev)

‎drivers/usb/typec/class.c‎

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -206,69 +206,6 @@ static void typec_altmode_put_partner(struct altmode *altmode)
206206
put_device(&adev->dev);
207207
}
208208

209-
staticvoid*typec_port_match(structdevice_connection*con,intep,void*data)
210-
{
211-
structdevice*dev;
212-
213-
/*
214-
* FIXME: Check does the fwnode supports the requested SVID. If it does
215-
* we need to return ERR_PTR(-PROBE_DEFER) when there is no device.
216-
*/
217-
if (con->fwnode)
218-
returnclass_find_device_by_fwnode(typec_class,con->fwnode);
219-
220-
dev=class_find_device_by_name(typec_class,con->endpoint[ep]);
221-
222-
returndev ?dev :ERR_PTR(-EPROBE_DEFER);
223-
}
224-
225-
structtypec_altmode*
226-
typec_altmode_register_notifier(structdevice*dev,u16svid,u8mode,
227-
structnotifier_block*nb)
228-
{
229-
structtypec_device_idid= {svid,mode, };
230-
structdevice*altmode_dev;
231-
structdevice*port_dev;
232-
structaltmode*altmode;
233-
intret;
234-
235-
/* Find the port linked to the caller */
236-
port_dev=device_connection_find_match(dev,NULL,NULL,
237-
typec_port_match);
238-
if (IS_ERR_OR_NULL(port_dev))
239-
returnport_dev ?ERR_CAST(port_dev) :ERR_PTR(-ENODEV);
240-
241-
/* Find the altmode with matching svid */
242-
altmode_dev=device_find_child(port_dev,&id,altmode_match);
243-
244-
put_device(port_dev);
245-
246-
if (!altmode_dev)
247-
returnERR_PTR(-ENODEV);
248-
249-
altmode=to_altmode(to_typec_altmode(altmode_dev));
250-
251-
/* Register notifier */
252-
ret=blocking_notifier_chain_register(&altmode->nh,nb);
253-
if (ret) {
254-
put_device(altmode_dev);
255-
returnERR_PTR(ret);
256-
}
257-
258-
return&altmode->adev;
259-
}
260-
EXPORT_SYMBOL_GPL(typec_altmode_register_notifier);
261-
262-
voidtypec_altmode_unregister_notifier(structtypec_altmode*adev,
263-
structnotifier_block*nb)
264-
{
265-
structaltmode*altmode=to_altmode(adev);
266-
267-
blocking_notifier_chain_unregister(&altmode->nh,nb);
268-
put_device(&adev->dev);
269-
}
270-
EXPORT_SYMBOL_GPL(typec_altmode_unregister_notifier);
271-
272209
/**
273210
* typec_altmode_update_active - Report Enter/Exit mode
274211
* @adev: Handle to the alternate mode
@@ -538,9 +475,7 @@ typec_register_altmode(struct device *parent,
538475
dev_set_name(&alt->adev.dev,"%s.%u",dev_name(parent),id);
539476

540477
/* Link partners and plugs with the ports */
541-
if (is_port)
542-
BLOCKING_INIT_NOTIFIER_HEAD(&alt->nh);
543-
else
478+
if (!is_port)
544479
typec_altmode_set_partner(alt);
545480

546481
/* The partners are bind to drivers */

‎include/linux/usb/typec_altmode.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ void typec_altmode_put_plug(struct typec_altmode *plug);
126126
structtypec_altmode*typec_match_altmode(structtypec_altmode**altmodes,
127127
size_tn,u16svid,u8mode);
128128

129-
structtypec_altmode*
130-
typec_altmode_register_notifier(structdevice*dev,u16svid,u8mode,
131-
structnotifier_block*nb);
132-
133-
voidtypec_altmode_unregister_notifier(structtypec_altmode*adev,
134-
structnotifier_block*nb);
135-
136129
/**
137130
* typec_altmode_get_orientation - Get cable plug orientation
138131
* altmode: Handle to the alternate mode

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp