staging: most: dim2: use device release method
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Tue, 5 Oct 2021 14:34:50 +0000 (17:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Dec 2021 09:30:16 +0000 (10:30 +0100)
commit18fc0ba9b10e1fb4f65a735cbf60ad6899133754
treebc3cb0f50c48e9b667b296142a3da6f19cf12f27
parent9985d29c4755ac94f016b7537e411bd1109a13e4
staging: most: dim2: use device release method

commit d445aa402d60014a37a199fae2bba379696b007d upstream.

Commit 723de0f9171e ("staging: most: remove device from interface
structure") moved registration of driver-provided struct device to
the most subsystem. This updated dim2 driver as well.

However, struct device passed to register_device() becomes refcounted,
and must not be explicitly deallocated, but must provide release method
instead. Which is incompatible with managing it via devres.

This patch makes the device structure allocated without devres, adds
device release method, and moves device destruction there.

Fixes: 723de0f9171e ("staging: most: remove device from interface structure")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Link: https://lore.kernel.org/r/20211005143448.8660-2-nikita.yoush@cogentembedded.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/dim2/dim2.c