Skip to content

Commit 6526b02

Browse files
jbrun3tdianders
authored andcommitted
drm/bridge: ti-sn65dsi86: use the auxiliary device
The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper. Use it and remove some boilerplate code. Signed-off-by: Jerome Brunet <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5e861a6 commit 6526b02

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -447,58 +447,23 @@ DEFINE_SHOW_ATTRIBUTE(status);
447447
* Auxiliary Devices (*not* AUX)
448448
*/
449449

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-
467450
static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata,
468451
struct auxiliary_device **aux_out,
469452
const char *name)
470453
{
471454
struct device *dev = pdata->dev;
472455
const struct i2c_client *client = to_i2c_client(dev);
473456
struct auxiliary_device *aux;
474-
int ret;
457+
int id;
475458

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);
477462
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;
500464

501-
return ret;
465+
*aux_out = aux;
466+
return 0;
502467
}
503468

504469
/* -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)