Skip to content

Commit 801a2b1

Browse files
ffainelliakpm00
authored andcommitted
scripts/gdb: fix lx-device-list-bus and lx-device-list-class
After the conversion to bus_to_subsys() and class_to_subsys(), the gdb scripts listing the system buses and classes respectively was broken, fix those by returning the subsys_priv pointer and have the various caller de-reference either the 'bus' or 'class' structure members accordingly. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7b884b7 ("driver core: class.c: convert to only use class_to_subsys") Signed-off-by: Florian Fainelli <[email protected]> Tested-by: Kuan-Ying Lee <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: Kieran Bingham <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bc220fe commit 801a2b1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/gdb/linux/device.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ def for_each_bus():
3636
for kobj in kset_for_each_object(gdb.parse_and_eval('bus_kset')):
3737
subsys = container_of(kobj, kset_type.get_type().pointer(), 'kobj')
3838
subsys_priv = container_of(subsys, subsys_private_type.get_type().pointer(), 'subsys')
39-
yield subsys_priv['bus']
39+
yield subsys_priv
4040

4141

4242
def for_each_class():
4343
for kobj in kset_for_each_object(gdb.parse_and_eval('class_kset')):
4444
subsys = container_of(kobj, kset_type.get_type().pointer(), 'kobj')
4545
subsys_priv = container_of(subsys, subsys_private_type.get_type().pointer(), 'subsys')
46-
yield subsys_priv['class']
46+
yield subsys_priv
4747

4848

4949
def get_bus_by_name(name):
5050
for item in for_each_bus():
51-
if item['name'].string() == name:
51+
if item['bus']['name'].string() == name:
5252
return item
5353
raise gdb.GdbError("Can't find bus type {!r}".format(name))
5454

5555

5656
def get_class_by_name(name):
5757
for item in for_each_class():
58-
if item['name'].string() == name:
58+
if item['class']['name'].string() == name:
5959
return item
6060
raise gdb.GdbError("Can't find device class {!r}".format(name))
6161

@@ -70,13 +70,13 @@ def klist_for_each(klist):
7070

7171

7272
def bus_for_each_device(bus):
73-
for kn in klist_for_each(bus['p']['klist_devices']):
73+
for kn in klist_for_each(bus['klist_devices']):
7474
dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_bus')
7575
yield dp['device']
7676

7777

7878
def class_for_each_device(cls):
79-
for kn in klist_for_each(cls['p']['klist_devices']):
79+
for kn in klist_for_each(cls['klist_devices']):
8080
dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_class')
8181
yield dp['device']
8282

@@ -103,7 +103,7 @@ def __init__(self):
103103
def invoke(self, arg, from_tty):
104104
if not arg:
105105
for bus in for_each_bus():
106-
gdb.write('bus {}:\t{}\n'.format(bus['name'].string(), bus))
106+
gdb.write('bus {}:\t{}\n'.format(bus['bus']['name'].string(), bus))
107107
for dev in bus_for_each_device(bus):
108108
_show_device(dev, level=1)
109109
else:
@@ -123,7 +123,7 @@ def __init__(self):
123123
def invoke(self, arg, from_tty):
124124
if not arg:
125125
for cls in for_each_class():
126-
gdb.write("class {}:\t{}\n".format(cls['name'].string(), cls))
126+
gdb.write("class {}:\t{}\n".format(cls['class']['name'].string(), cls))
127127
for dev in class_for_each_device(cls):
128128
_show_device(dev, level=1)
129129
else:

0 commit comments

Comments
 (0)