@@ -447,58 +447,23 @@ DEFINE_SHOW_ATTRIBUTE(status);
447
447
* Auxiliary Devices (*not* AUX)
448
448
*/
449
449
450
- static void ti_sn65dsi86_uninit_aux (void * data )
451
- {
452
- auxiliary_device_uninit (data );
453
- }
454
-
455
- static void ti_sn65dsi86_delete_aux (void * data )
456
- {
457
- auxiliary_device_delete (data );
458
- }
459
-
460
- static void ti_sn65dsi86_aux_device_release (struct device * dev )
461
- {
462
- struct auxiliary_device * aux = container_of (dev , struct auxiliary_device , dev );
463
-
464
- kfree (aux );
465
- }
466
-
467
450
static int ti_sn65dsi86_add_aux_device (struct ti_sn65dsi86 * pdata ,
468
451
struct auxiliary_device * * aux_out ,
469
452
const char * name )
470
453
{
471
454
struct device * dev = pdata -> dev ;
472
455
const struct i2c_client * client = to_i2c_client (dev );
473
456
struct auxiliary_device * aux ;
474
- int ret ;
457
+ int id ;
475
458
476
- aux = kzalloc (sizeof (* aux ), GFP_KERNEL );
459
+ id = (client -> adapter -> nr << 10 ) | client -> addr ;
460
+ aux = __devm_auxiliary_device_create (dev , KBUILD_MODNAME , name ,
461
+ NULL , id );
477
462
if (!aux )
478
- return - ENOMEM ;
479
-
480
- aux -> name = name ;
481
- aux -> id = (client -> adapter -> nr << 10 ) | client -> addr ;
482
- aux -> dev .parent = dev ;
483
- aux -> dev .release = ti_sn65dsi86_aux_device_release ;
484
- device_set_of_node_from_dev (& aux -> dev , dev );
485
- ret = auxiliary_device_init (aux );
486
- if (ret ) {
487
- kfree (aux );
488
- return ret ;
489
- }
490
- ret = devm_add_action_or_reset (dev , ti_sn65dsi86_uninit_aux , aux );
491
- if (ret )
492
- return ret ;
493
-
494
- ret = auxiliary_device_add (aux );
495
- if (ret )
496
- return ret ;
497
- ret = devm_add_action_or_reset (dev , ti_sn65dsi86_delete_aux , aux );
498
- if (!ret )
499
- * aux_out = aux ;
463
+ return - ENODEV ;
500
464
501
- return ret ;
465
+ * aux_out = aux ;
466
+ return 0 ;
502
467
}
503
468
504
469
/* -----------------------------------------------------------------------------
0 commit comments