Subject: Replacement to of_register_platform_driver ?

From: Guillaume Dargaud <[email-masked]>
Date: Wed, 13 Jun 2012 17:21:22 +0200

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/