]> git.baikalelectronics.ru Git - kernel.git/commit
counter: Use container_of instead of drvdata to track counter_device
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 30 Dec 2021 15:02:38 +0000 (16:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Dec 2021 16:44:05 +0000 (17:44 +0100)
commitfb79586fb98222949d2682b1b8d1462a20cb4e9c
tree6f7af09aad8eeba4879e89c448992c4ca49a68db
parenta8bca3a1a31be19fb889a52b06e5118665a1de48
counter: Use container_of instead of drvdata to track counter_device

The counter core uses drvdata to find a struct counter_device from a
struct device. However as the device is a member of struct counter_device,
the lookup can be done faster (and a bit type safe) using container_of.

There are no other users of drvdata, so the call to dev_set_drvdata can
go away, too.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/counter/counter-core.c