@@ -63,7 +63,7 @@ struct master {
6363 bool bound ;
6464
6565 const struct component_master_ops * ops ;
66- struct device * dev ;
66+ struct device * parent ;
6767 struct component_match * match ;
6868};
6969
@@ -95,7 +95,7 @@ static int component_devices_show(struct seq_file *s, void *data)
9595 seq_printf (s , "%-40s %20s\n" , "master name" , "status" );
9696 seq_puts (s , "-------------------------------------------------------------\n" );
9797 seq_printf (s , "%-40s %20s\n\n" ,
98- dev_name (m -> dev ), m -> bound ? "bound" : "not bound" );
98+ dev_name (m -> parent ), m -> bound ? "bound" : "not bound" );
9999
100100 seq_printf (s , "%-40s %20s\n" , "device name" , "status" );
101101 seq_puts (s , "-------------------------------------------------------------\n" );
@@ -124,13 +124,13 @@ core_initcall(component_debug_init);
124124
125125static void component_master_debugfs_add (struct master * m )
126126{
127- debugfs_create_file (dev_name (m -> dev ), 0444 , component_debugfs_dir , m ,
127+ debugfs_create_file (dev_name (m -> parent ), 0444 , component_debugfs_dir , m ,
128128 & component_devices_fops );
129129}
130130
131131static void component_master_debugfs_del (struct master * m )
132132{
133- debugfs_remove (debugfs_lookup (dev_name (m -> dev ), component_debugfs_dir ));
133+ debugfs_remove (debugfs_lookup (dev_name (m -> parent ), component_debugfs_dir ));
134134}
135135
136136#else
@@ -143,13 +143,13 @@ static void component_master_debugfs_del(struct master *m)
143143
144144#endif
145145
146- static struct master * __master_find (struct device * dev ,
146+ static struct master * __master_find (struct device * parent ,
147147 const struct component_master_ops * ops )
148148{
149149 struct master * m ;
150150
151151 list_for_each_entry (m , & masters , node )
152- if (m -> dev == dev && (!ops || m -> ops == ops ))
152+ if (m -> parent == parent && (!ops || m -> ops == ops ))
153153 return m ;
154154
155155 return NULL ;
@@ -189,7 +189,7 @@ static int find_components(struct master *master)
189189 struct component_match_array * mc = & match -> compare [i ];
190190 struct component * c ;
191191
192- dev_dbg (master -> dev , "Looking for component %zu\n" , i );
192+ dev_dbg (master -> parent , "Looking for component %zu\n" , i );
193193
194194 if (match -> compare [i ].component )
195195 continue ;
@@ -200,7 +200,7 @@ static int find_components(struct master *master)
200200 break ;
201201 }
202202
203- dev_dbg (master -> dev , "found component %s, duplicate %u\n" , dev_name (c -> dev ), !!c -> master );
203+ dev_dbg (master -> parent , "found component %s, duplicate %u\n" , dev_name (c -> dev ), !!c -> master );
204204
205205 /* Attach this component to the master */
206206 match -> compare [i ].duplicate = !!c -> master ;
@@ -233,28 +233,28 @@ static int try_to_bring_up_master(struct master *master,
233233{
234234 int ret ;
235235
236- dev_dbg (master -> dev , "trying to bring up master\n" );
236+ dev_dbg (master -> parent , "trying to bring up master\n" );
237237
238238 if (find_components (master )) {
239- dev_dbg (master -> dev , "master has incomplete components\n" );
239+ dev_dbg (master -> parent , "master has incomplete components\n" );
240240 return 0 ;
241241 }
242242
243243 if (component && component -> master != master ) {
244- dev_dbg (master -> dev , "master is not for this component (%s)\n" ,
244+ dev_dbg (master -> parent , "master is not for this component (%s)\n" ,
245245 dev_name (component -> dev ));
246246 return 0 ;
247247 }
248248
249- if (!devres_open_group (master -> dev , NULL , GFP_KERNEL ))
249+ if (!devres_open_group (master -> parent , NULL , GFP_KERNEL ))
250250 return - ENOMEM ;
251251
252252 /* Found all components */
253- ret = master -> ops -> bind (master -> dev );
253+ ret = master -> ops -> bind (master -> parent );
254254 if (ret < 0 ) {
255- devres_release_group (master -> dev , NULL );
255+ devres_release_group (master -> parent , NULL );
256256 if (ret != - EPROBE_DEFER )
257- dev_info (master -> dev , "master bind failed: %d\n" , ret );
257+ dev_info (master -> parent , "master bind failed: %d\n" , ret );
258258 return ret ;
259259 }
260260
@@ -281,34 +281,28 @@ static int try_to_bring_up_masters(struct component *component)
281281static void take_down_master (struct master * master )
282282{
283283 if (master -> bound ) {
284- master -> ops -> unbind (master -> dev );
285- devres_release_group (master -> dev , NULL );
284+ master -> ops -> unbind (master -> parent );
285+ devres_release_group (master -> parent , NULL );
286286 master -> bound = false;
287287 }
288288}
289289
290- static void component_match_release (struct device * master ,
291- struct component_match * match )
290+ static void devm_component_match_release (struct device * parent , void * res )
292291{
292+ struct component_match * match = res ;
293293 unsigned int i ;
294294
295295 for (i = 0 ; i < match -> num ; i ++ ) {
296296 struct component_match_array * mc = & match -> compare [i ];
297297
298298 if (mc -> release )
299- mc -> release (master , mc -> data );
299+ mc -> release (parent , mc -> data );
300300 }
301301
302302 kfree (match -> compare );
303303}
304304
305- static void devm_component_match_release (struct device * dev , void * res )
306- {
307- component_match_release (dev , res );
308- }
309-
310- static int component_match_realloc (struct device * dev ,
311- struct component_match * match , size_t num )
305+ static int component_match_realloc (struct component_match * match , size_t num )
312306{
313307 struct component_match_array * new ;
314308
@@ -359,7 +353,7 @@ static void __component_match_add(struct device *master,
359353 size_t new_size = match -> alloc + 16 ;
360354 int ret ;
361355
362- ret = component_match_realloc (master , match , new_size );
356+ ret = component_match_realloc (match , new_size );
363357 if (ret ) {
364358 * matchptr = ERR_PTR (ret );
365359 return ;
@@ -451,7 +445,7 @@ static void free_master(struct master *master)
451445
452446/**
453447 * component_master_add_with_match - register an aggregate driver
454- * @dev: device with the aggregate driver
448+ * @parent: parent device of the aggregate driver
455449 * @ops: callbacks for the aggregate driver
456450 * @match: component match list for the aggregate driver
457451 *
@@ -461,23 +455,23 @@ static void free_master(struct master *master)
461455 * &component_master_ops.bind from @ops. Must be unregistered by calling
462456 * component_master_del().
463457 */
464- int component_master_add_with_match (struct device * dev ,
458+ int component_master_add_with_match (struct device * parent ,
465459 const struct component_master_ops * ops ,
466460 struct component_match * match )
467461{
468462 struct master * master ;
469463 int ret ;
470464
471465 /* Reallocate the match array for its true size */
472- ret = component_match_realloc (dev , match , match -> num );
466+ ret = component_match_realloc (match , match -> num );
473467 if (ret )
474468 return ret ;
475469
476470 master = kzalloc (sizeof (* master ), GFP_KERNEL );
477471 if (!master )
478472 return - ENOMEM ;
479473
480- master -> dev = dev ;
474+ master -> parent = parent ;
481475 master -> ops = ops ;
482476 master -> match = match ;
483477
@@ -499,20 +493,20 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match);
499493
500494/**
501495 * component_master_del - unregister an aggregate driver
502- * @dev: device with the aggregate driver
496+ * @parent: parent device of the aggregate driver
503497 * @ops: callbacks for the aggregate driver
504498 *
505499 * Unregisters an aggregate driver registered with
506500 * component_master_add_with_match(). If necessary the aggregate driver is first
507501 * disassembled by calling &component_master_ops.unbind from @ops.
508502 */
509- void component_master_del (struct device * dev ,
503+ void component_master_del (struct device * parent ,
510504 const struct component_master_ops * ops )
511505{
512506 struct master * master ;
513507
514508 mutex_lock (& component_mutex );
515- master = __master_find (dev , ops );
509+ master = __master_find (parent , ops );
516510 if (master ) {
517511 take_down_master (master );
518512 free_master (master );
@@ -527,7 +521,7 @@ static void component_unbind(struct component *component,
527521 WARN_ON (!component -> bound );
528522
529523 if (component -> ops && component -> ops -> unbind )
530- component -> ops -> unbind (component -> dev , master -> dev , data );
524+ component -> ops -> unbind (component -> dev , master -> parent , data );
531525 component -> bound = false;
532526
533527 /* Release all resources claimed in the binding of this component */
@@ -536,22 +530,22 @@ static void component_unbind(struct component *component,
536530
537531/**
538532 * component_unbind_all - unbind all components of an aggregate driver
539- * @master_dev: device with the aggregate driver
533+ * @parent: parent device of the aggregate driver
540534 * @data: opaque pointer, passed to all components
541535 *
542- * Unbinds all components of the aggregate @dev by passing @data to their
536+ * Unbinds all components of the aggregate device by passing @data to their
543537 * &component_ops.unbind functions. Should be called from
544538 * &component_master_ops.unbind.
545539 */
546- void component_unbind_all (struct device * master_dev , void * data )
540+ void component_unbind_all (struct device * parent , void * data )
547541{
548542 struct master * master ;
549543 struct component * c ;
550544 size_t i ;
551545
552546 WARN_ON (!mutex_is_locked (& component_mutex ));
553547
554- master = __master_find (master_dev , NULL );
548+ master = __master_find (parent , NULL );
555549 if (!master )
556550 return ;
557551
@@ -574,7 +568,7 @@ static int component_bind(struct component *component, struct master *master,
574568 * This allows us to roll-back a failed component without
575569 * affecting anything else.
576570 */
577- if (!devres_open_group (master -> dev , NULL , GFP_KERNEL ))
571+ if (!devres_open_group (master -> parent , NULL , GFP_KERNEL ))
578572 return - ENOMEM ;
579573
580574 /*
@@ -583,14 +577,14 @@ static int component_bind(struct component *component, struct master *master,
583577 * at the appropriate moment.
584578 */
585579 if (!devres_open_group (component -> dev , component , GFP_KERNEL )) {
586- devres_release_group (master -> dev , NULL );
580+ devres_release_group (master -> parent , NULL );
587581 return - ENOMEM ;
588582 }
589583
590- dev_dbg (master -> dev , "binding %s (ops %ps)\n" ,
584+ dev_dbg (master -> parent , "binding %s (ops %ps)\n" ,
591585 dev_name (component -> dev ), component -> ops );
592586
593- ret = component -> ops -> bind (component -> dev , master -> dev , data );
587+ ret = component -> ops -> bind (component -> dev , master -> parent , data );
594588 if (!ret ) {
595589 component -> bound = true;
596590
@@ -601,16 +595,16 @@ static int component_bind(struct component *component, struct master *master,
601595 * can clean those resources up independently.
602596 */
603597 devres_close_group (component -> dev , NULL );
604- devres_remove_group (master -> dev , NULL );
598+ devres_remove_group (master -> parent , NULL );
605599
606- dev_info (master -> dev , "bound %s (ops %ps)\n" ,
600+ dev_info (master -> parent , "bound %s (ops %ps)\n" ,
607601 dev_name (component -> dev ), component -> ops );
608602 } else {
609603 devres_release_group (component -> dev , NULL );
610- devres_release_group (master -> dev , NULL );
604+ devres_release_group (master -> parent , NULL );
611605
612606 if (ret != - EPROBE_DEFER )
613- dev_err (master -> dev , "failed to bind %s (ops %ps): %d\n" ,
607+ dev_err (master -> parent , "failed to bind %s (ops %ps): %d\n" ,
614608 dev_name (component -> dev ), component -> ops , ret );
615609 }
616610
@@ -619,14 +613,14 @@ static int component_bind(struct component *component, struct master *master,
619613
620614/**
621615 * component_bind_all - bind all components of an aggregate driver
622- * @master_dev: device with the aggregate driver
616+ * @parent: parent device of the aggregate driver
623617 * @data: opaque pointer, passed to all components
624618 *
625619 * Binds all components of the aggregate @dev by passing @data to their
626620 * &component_ops.bind functions. Should be called from
627621 * &component_master_ops.bind.
628622 */
629- int component_bind_all (struct device * master_dev , void * data )
623+ int component_bind_all (struct device * parent , void * data )
630624{
631625 struct master * master ;
632626 struct component * c ;
@@ -635,7 +629,7 @@ int component_bind_all(struct device *master_dev, void *data)
635629
636630 WARN_ON (!mutex_is_locked (& component_mutex ));
637631
638- master = __master_find (master_dev , NULL );
632+ master = __master_find (parent , NULL );
639633 if (!master )
640634 return - EINVAL ;
641635
0 commit comments