I'm not a driver expert either, but from my experience with C, I can attempt to explain enough to get you going further.
The first line you ask about is your driver's definition of a function that accepts the types defined for the three arguments vc_cons[fg_console].d->port.tty
, KDSETLED
, and *pstatus
(my_driver->ops->ioctl)
is a function that exists within the struct ops
nested within the struct my_driver
.
The line combined
(my_driver->ops->ioctl) (vc_cons[fg_console].d->port.tty, KDSETLED,*pstatus)
;
is calling that function with the above mentioned arguments.
Understanding what the static int __init kbleds_init(void)
function is doing as a whole will require you to look through the various headers you have included to find out the definitions and structure of the data types you're using (so you can find out what the .d
is in vc_cons[fg_console]
is). That pointer has a port field that has property tty
which corresponds to the teletype that you'll actually send the "turn the LED on" command to. The KDSETLED
is a code that corresponds to "LED ON", and the final argument is the command status pointer.
Many of these references are #define macros and structs that define the format that is required by the kernel for you to drive LED's on a keyboard with your driver, for this example.
Hope this helps some. Good luck.