[PATCH] powernv/pci: Add PHB register dump debugfs handle
Michael Ellerman
mpe at ellerman.id.au
Tue Jul 26 19:47:10 AEST 2016
Russell Currey <ruscur at russell.cc> writes:
> On Tue, 2016-07-26 at 11:45 +1000, Michael Ellerman wrote:
>> Quoting Russell Currey (2016-07-22 15:23:36)
>>
>> DEFINE_SIMPLE_ATTRIBUTE(fops_foo, NULL, foo_set, "%llu\n");
>>
>> That requires that you write "1" to the file to trigger the reg dump.
>
> I don't think I can use this here. Triggering the diag dump on the given PHB
> (these are in /sys/kernel/debug/powerpc/PCI####), and that PHB is retrieved from
> the file handler. It looks like I have no access to the file struct if using a
> simple getter/setter.
You don't have access to the file struct, but you don't need it, can
register the fops with a data pointer.
So the DEFINE_SIMPLE_ATTRIBUTE() gives you a fops_foo, which you can
then do:
debugfs_create_file("dump-regs", 0200, phb->dbgfs, hose, &fops_foo))
And then in foo_set() data == hose.
cheers
More information about the Linuxppc-dev
mailing list