All of lore.kernel.org
 help / color / mirror / Atom feed
* Replacement to of_register_platform_driver ?
@ 2012-06-13 15:21 Guillaume Dargaud
  2012-06-13 17:47 ` Ira W. Snyder
  2012-06-14  0:28 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Guillaume Dargaud @ 2012-06-13 15:21 UTC (permalink / raw)
  To: linuxppc-dev

Hello all,
I just updated to the most recent kernel and a driver I wrote last year 
won't compile:
xad.c:534:2: error: implicit declaration of function 
'of_register_platform_driver'

I see references to this function as 'obsolete' but could not find 
what's the new recommended way to do things. Here's a bit of the 
offending code:

static struct of_platform_driver xad_driver = {
	.probe  = xad_driver_probe,
	.remove = xad_driver_remove,
	.driver = {
		.owner = THIS_MODULE,
		.name = "xad-driver",
		.of_match_table = xad_device_id,
	},
};

...

static int __init xad_init(void) {
...	
	first = MKDEV (my_major, my_minor);
	register_chrdev_region(first, count, DEVNAME);
	my_cdev = cdev_alloc ();
	if (NULL==my_cdev) goto Err;
	
	cdev_init(my_cdev, &fops);
	rc=cdev_add (my_cdev, first, count);
...	
	rc = of_register_platform_driver(&xad_driver);
...
}


-- 
Guillaume Dargaud
http://www.gdargaud.net/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replacement to of_register_platform_driver ?
  2012-06-13 15:21 Replacement to of_register_platform_driver ? Guillaume Dargaud
@ 2012-06-13 17:47 ` Ira W. Snyder
  2012-06-14  0:28 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Ira W. Snyder @ 2012-06-13 17:47 UTC (permalink / raw)
  To: Guillaume Dargaud; +Cc: linuxppc-dev

On Wed, Jun 13, 2012 at 05:21:22PM +0200, Guillaume Dargaud wrote:
> Hello all,
> I just updated to the most recent kernel and a driver I wrote last year 
> won't compile:
> xad.c:534:2: error: implicit declaration of function 
> 'of_register_platform_driver'
> 
> I see references to this function as 'obsolete' but could not find 
> what's the new recommended way to do things. Here's a bit of the 
> offending code:
> 
> static struct of_platform_driver xad_driver = {
> 	.probe  = xad_driver_probe,
> 	.remove = xad_driver_remove,
> 	.driver = {
> 		.owner = THIS_MODULE,
> 		.name = "xad-driver",
> 		.of_match_table = xad_device_id,
> 	},
> };
> 
> ...
> 
> static int __init xad_init(void) {
> ...	
> 	first = MKDEV (my_major, my_minor);
> 	register_chrdev_region(first, count, DEVNAME);
> 	my_cdev = cdev_alloc ();
> 	if (NULL==my_cdev) goto Err;
> 	
> 	cdev_init(my_cdev, &fops);
> 	rc=cdev_add (my_cdev, first, count);
> ...	
> 	rc = of_register_platform_driver(&xad_driver);
> ...
> }
> 
> 
> -- 
> Guillaume Dargaud
> http://www.gdargaud.net/
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

The history of drivers/misc/carma/carma-fpga.c will show you the code
changes necessary. Specifically, these two commits perform the
conversion:

493340207 carma-fpga: Missed switch from of_register_platform_driver()
b00e126ff MISC: convert drivers/misc/* to use module_platform_driver()

Hope it helps,
Ira

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Replacement to of_register_platform_driver ?
  2012-06-13 15:21 Replacement to of_register_platform_driver ? Guillaume Dargaud
  2012-06-13 17:47 ` Ira W. Snyder
@ 2012-06-14  0:28 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2012-06-14  0:28 UTC (permalink / raw)
  To: Guillaume Dargaud; +Cc: linuxppc-dev

On Wed, 2012-06-13 at 17:21 +0200, Guillaume Dargaud wrote:
> Hello all,
> I just updated to the most recent kernel and a driver I wrote last year 
> won't compile:
> xad.c:534:2: error: implicit declaration of function 
> 'of_register_platform_driver'
> 
> I see references to this function as 'obsolete' but could not find 
> what's the new recommended way to do things.

The "of" bits were merged with the regular platform driver. So you
should use a platform_driver, which basically means remove "of_"
everywhere.

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-14  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 15:21 Replacement to of_register_platform_driver ? Guillaume Dargaud
2012-06-13 17:47 ` Ira W. Snyder
2012-06-14  0:28 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.