Re: "driver model" confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

> On Tue, Sep 22, 2009 at 9:59 AM, Michal Ludvig <mludvig@xxxxxxxxxxxx> wrote:
>> Hi all,
>>
>> I've got a digital IO board sitting on a ISA bus in an industrial x86
>> computer. I've got a simple driver with ioctl interface for toggling the
>> IO pins Hi and Low and it works fine.
>>
>> Now I'm about to develop a bitbanging SPI driver with the use of
>> drivers/spi/spi_bitbang.c. Unfortunately I don't understand how to glue
>> it with my IO driver, more precisely - how to register a new SPI driver.
>>
>> The other modules in drivers/spi seem to use platform_driver_register()
>> or spi_register_driver() to get their blah_probe() called and then they
>> go from there. However, whatever I tried, my _probe() method never gets
>> called. The module is as simple as this (remove/exit methods omitted
>> from this email):
>>
> 
>>From here:
> 
> http://www.mjmwired.net/kernel/Documentation/spi/spi-summary
> 
> it seemed that SPI's internal is very much board specifics, so perhaps
> u would like let us know the board identity?
> 
> http://www.linuxforums.org/forum/linux-kernel/143191-question-about-adding-spi-driver-support.html
> 
> This following is a board-specific howto:
> 
> http://www.at91.com/samphpbb/viewtopic.php?f=12&t=18280

The trick was to register the device prior to registering the driver for
it. In my module_init function I do:

    pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
    [...]
    ret = platform_driver_register(&inro_spi_drv);

and that seems to work and calls my _probe().

Michal



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux