Re: cdev to pdev

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

 



Greg KH wrote:

I wrote
so, wheres my device ?

Depends on what your driver is, and where it stores it.

dont I automatically get one, perhaps under the covers ?

Depends on what type of driver you are.  If you are an i2c driver, you
get one.  A PCI driver, you get one.  A USB driver, you get one.  A
platform driver, well, you might be on your own, you have to create
yours, using the platform api.

ok - got something that works.

+
+       pdev = platform_device_register_simple(DRVNAME, 0, NULL, 0);
+       if (!pdev) {
+               printk(KERN_ERR NAME "Error %d on minor %d", rc, i);
+       } else {
+               dev_err(pdev, "devinfo works! %d devs\n", i);
+       }
       return 0;               /* succeed */



So, style question.  In scx200_gpio_init, Ive got to
   devices = kzalloc
   register-chrdev-region
   platform-device-register

presuming that I should be calling all 3, is there any reason to prefer 1 order vs another ?
most-likely to fail 1st ?   and which is that ?




couldnt the others be also (if later).

I also found this:
**Subject: Driver model ISA bus**
http://marc.theaimsgroup.com/?l=linux-kernel&m=114678055902797&w=2
It looks interesting - anything that simplifies stuff is -
but alas - theres no empty-isa-driver.c for me to start from.

It's getting there, hasn't made it into any kernel trees yet...

thanks,

greg k-h



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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