Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/20231130043317.174188-1-florian.fainelli@broadcom.com
Fixes: 7b884b7f24b4 ("driver core: class.c: convert to only use class_to_subsys")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Florian Fainelli and committed by
Andrew Morton
801a2b1b bc220fe7

+8 -8
+8 -8
scripts/gdb/linux/device.py
··· 36 36 for kobj in kset_for_each_object(gdb.parse_and_eval('bus_kset')): 37 37 subsys = container_of(kobj, kset_type.get_type().pointer(), 'kobj') 38 38 subsys_priv = container_of(subsys, subsys_private_type.get_type().pointer(), 'subsys') 39 - yield subsys_priv['bus'] 39 + yield subsys_priv 40 40 41 41 42 42 def for_each_class(): 43 43 for kobj in kset_for_each_object(gdb.parse_and_eval('class_kset')): 44 44 subsys = container_of(kobj, kset_type.get_type().pointer(), 'kobj') 45 45 subsys_priv = container_of(subsys, subsys_private_type.get_type().pointer(), 'subsys') 46 - yield subsys_priv['class'] 46 + yield subsys_priv 47 47 48 48 49 49 def get_bus_by_name(name): 50 50 for item in for_each_bus(): 51 - if item['name'].string() == name: 51 + if item['bus']['name'].string() == name: 52 52 return item 53 53 raise gdb.GdbError("Can't find bus type {!r}".format(name)) 54 54 55 55 56 56 def get_class_by_name(name): 57 57 for item in for_each_class(): 58 - if item['name'].string() == name: 58 + if item['class']['name'].string() == name: 59 59 return item 60 60 raise gdb.GdbError("Can't find device class {!r}".format(name)) 61 61 ··· 70 70 71 71 72 72 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']): 74 74 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_bus') 75 75 yield dp['device'] 76 76 77 77 78 78 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']): 80 80 dp = container_of(kn, device_private_type.get_type().pointer(), 'knode_class') 81 81 yield dp['device'] 82 82 ··· 103 103 def invoke(self, arg, from_tty): 104 104 if not arg: 105 105 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)) 107 107 for dev in bus_for_each_device(bus): 108 108 _show_device(dev, level=1) 109 109 else: ··· 123 123 def invoke(self, arg, from_tty): 124 124 if not arg: 125 125 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)) 127 127 for dev in class_for_each_device(cls): 128 128 _show_device(dev, level=1) 129 129 else: