@@ -344,108 +344,56 @@ void platform_device_unregister(struct platform_device *pdev)
344344EXPORT_SYMBOL_GPL (platform_device_unregister );
345345
346346/**
347- * platform_device_register_simple - add a platform-level device and its resources
348- * @name: base name of the device we're adding
349- * @id: instance id
350- * @res: set of resources that needs to be allocated for the device
351- * @num: number of resources
352- *
353- * This function creates a simple platform device that requires minimal
354- * resource and memory management. Canned release function freeing memory
355- * allocated for the device allows drivers using such devices to be
356- * unloaded without waiting for the last reference to the device to be
357- * dropped.
347+ * platform_device_register_resndata - add a platform-level device with
348+ * resources and platform-specific data
358349 *
359- * This interface is primarily intended for use with legacy drivers which
360- * probe hardware directly. Because such drivers create sysfs device nodes
361- * themselves, rather than letting system infrastructure handle such device
362- * enumeration tasks, they don't fully conform to the Linux driver model.
363- * In particular, when such drivers are built as modules, they can't be
364- * "hotplugged".
365- *
366- * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
367- */
368- struct platform_device * platform_device_register_simple (const char * name ,
369- int id ,
370- const struct resource * res ,
371- unsigned int num )
372- {
373- struct platform_device * pdev ;
374- int retval ;
375-
376- pdev = platform_device_alloc (name , id );
377- if (!pdev ) {
378- retval = - ENOMEM ;
379- goto error ;
380- }
381-
382- if (num ) {
383- retval = platform_device_add_resources (pdev , res , num );
384- if (retval )
385- goto error ;
386- }
387-
388- retval = platform_device_add (pdev );
389- if (retval )
390- goto error ;
391-
392- return pdev ;
393-
394- error :
395- platform_device_put (pdev );
396- return ERR_PTR (retval );
397- }
398- EXPORT_SYMBOL_GPL (platform_device_register_simple );
399-
400- /**
401- * platform_device_register_data - add a platform-level device with platform-specific data
402350 * @parent: parent device for the device we're adding
403351 * @name: base name of the device we're adding
404352 * @id: instance id
353+ * @res: set of resources that needs to be allocated for the device
354+ * @num: number of resources
405355 * @data: platform specific data for this platform device
406356 * @size: size of platform specific data
407357 *
408- * This function creates a simple platform device that requires minimal
409- * resource and memory management. Canned release function freeing memory
410- * allocated for the device allows drivers using such devices to be
411- * unloaded without waiting for the last reference to the device to be
412- * dropped.
413- *
414358 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
415359 */
416- struct platform_device * platform_device_register_data (
360+ struct platform_device * platform_device_register_resndata (
417361 struct device * parent ,
418362 const char * name , int id ,
363+ const struct resource * res , unsigned int num ,
419364 const void * data , size_t size )
420365{
366+ int ret = - ENOMEM ;
421367 struct platform_device * pdev ;
422- int retval ;
423368
424369 pdev = platform_device_alloc (name , id );
425- if (!pdev ) {
426- retval = - ENOMEM ;
427- goto error ;
428- }
370+ if (!pdev )
371+ goto err ;
429372
430373 pdev -> dev .parent = parent ;
431374
432- if (size ) {
433- retval = platform_device_add_data (pdev , data , size );
434- if (retval )
435- goto error ;
375+ if (res ) {
376+ ret = platform_device_add_resources (pdev , res , num );
377+ if (ret )
378+ goto err ;
436379 }
437380
438- retval = platform_device_add (pdev );
439- if (retval )
440- goto error ;
381+ if (data ) {
382+ ret = platform_device_add_data (pdev , data , size );
383+ if (ret )
384+ goto err ;
385+ }
441386
442- return pdev ;
387+ ret = platform_device_add (pdev );
388+ if (ret ) {
389+ err :
390+ platform_device_put (pdev );
391+ return ERR_PTR (ret );
392+ }
443393
444- error :
445- platform_device_put (pdev );
446- return ERR_PTR (retval );
394+ return pdev ;
447395}
448- EXPORT_SYMBOL_GPL (platform_device_register_data );
396+ EXPORT_SYMBOL_GPL (platform_device_register_resndata );
449397
450398static int platform_drv_probe (struct device * _dev )
451399{
0 commit comments