2021-11-24 19:13:54

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 02/20] media: saa7134-go7007: get rid of to_state() function

This is just an alias for container_of() and it is used only
on a commented code. The commented code actually is an issue that
require fixes, so, move the container_of() call to the commented
code, and drop the unused function.

This way, a fix for the function could be added later without
needing to re-add to_state() function.

This fixes a clang W=1 warning.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/pci/saa7134/saa7134-go7007.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c b/drivers/media/pci/saa7134/saa7134-go7007.c
index f319edb39c0e..da83893ffee9 100644
--- a/drivers/media/pci/saa7134/saa7134-go7007.c
+++ b/drivers/media/pci/saa7134/saa7134-go7007.c
@@ -56,11 +56,6 @@ struct saa7134_go7007 {
dma_addr_t bottom_dma;
};

-static inline struct saa7134_go7007 *to_state(struct v4l2_subdev *sd)
-{
- return container_of(sd, struct saa7134_go7007, sd);
-}
-
static const struct go7007_board_info board_voyager = {
.flags = 0,
.sensor_flags = GO7007_SENSOR_656 |
@@ -385,7 +380,7 @@ MODULE_FIRMWARE("go7007/go7007tv.bin");
static int saa7134_go7007_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
{
#if 0
- struct saa7134_go7007 *saa = to_state(sd);
+ struct saa7134_go7007 *saa = container_of(sd, struct saa7134_go7007, sd);
struct saa7134_dev *dev = saa->dev;

return saa7134_s_std_internal(dev, NULL, norm);
--
2.33.1



2021-11-26 19:32:59

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 02/20] media: saa7134-go7007: get rid of to_state() function

On Wed, Nov 24, 2021 at 08:13:05PM +0100, Mauro Carvalho Chehab wrote:
> This is just an alias for container_of() and it is used only
> on a commented code. The commented code actually is an issue that
> require fixes, so, move the container_of() call to the commented
> code, and drop the unused function.
>
> This way, a fix for the function could be added later without
> needing to re-add to_state() function.
>
> This fixes a clang W=1 warning.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/pci/saa7134/saa7134-go7007.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c b/drivers/media/pci/saa7134/saa7134-go7007.c
> index f319edb39c0e..da83893ffee9 100644
> --- a/drivers/media/pci/saa7134/saa7134-go7007.c
> +++ b/drivers/media/pci/saa7134/saa7134-go7007.c
> @@ -56,11 +56,6 @@ struct saa7134_go7007 {
> dma_addr_t bottom_dma;
> };
>
> -static inline struct saa7134_go7007 *to_state(struct v4l2_subdev *sd)
> -{
> - return container_of(sd, struct saa7134_go7007, sd);
> -}
> -
> static const struct go7007_board_info board_voyager = {
> .flags = 0,
> .sensor_flags = GO7007_SENSOR_656 |
> @@ -385,7 +380,7 @@ MODULE_FIRMWARE("go7007/go7007tv.bin");
> static int saa7134_go7007_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
> {
> #if 0
> - struct saa7134_go7007 *saa = to_state(sd);
> + struct saa7134_go7007 *saa = container_of(sd, struct saa7134_go7007, sd);
> struct saa7134_dev *dev = saa->dev;
>
> return saa7134_s_std_internal(dev, NULL, norm);
> --
> 2.33.1
>
>