On Wed, Nov 2, 2016 at 2:23 PM, Niklas Söderlund
<[email protected]> wrote:
> When Gen3 support is added to the driver more then chip id will be
> different for the different Soc. To avoid a lot of if statements in the
> code create a struct chip_info to contain this information.
>
> Signed-off-by: Niklas Söderlund <[email protected]>
> ---
> drivers/media/platform/rcar-vin/rcar-core.c | 49
> ++++++++++++++++++++++++-----
> drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 +-
> drivers/media/platform/rcar-vin/rcar-vin.h | 12 +++++--
> 3 files changed, 53 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c
> b/drivers/media/platform/rcar-vin/rcar-core.c
> index 5807d8d..372443e 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -253,14 +253,47 @@ static int rvin_digital_graph_init(struct rvin_dev *vin)
> * Platform Device Driver
> */
>
> +static const struct rvin_info rcar_info_h1 = {
> + .chip = RCAR_H1,
> +};
> +
> +static const struct rvin_info rcar_info_m1 = {
> + .chip = RCAR_M1,
> +};
> +
> +static const struct rvin_info rcar_info_gen2 = {
> + .chip = RCAR_GEN2,
> +};
> +
> static const struct of_device_id rvin_of_id_table[] = {
> - { .compatible = "renesas,vin-r8a7794", .data = (void *)RCAR_GEN2 },
> - { .compatible = "renesas,vin-r8a7793", .data = (void *)RCAR_GEN2 },
> - { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 },
> - { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 },
> - { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 },
> - { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 },
> - { .compatible = "renesas,rcar-gen2-vin", .data = (void *)RCAR_GEN2 },
> + {
> + .compatible = "renesas,vin-r8a7794",
> + .data = (void *)&rcar_info_gen2,
These casts are not needed.
> + },
> + {
> + .compatible = "renesas,vin-r8a7793",
> + .data = (void *)&rcar_info_gen2,
> + },
> + {
> + .compatible = "renesas,vin-r8a7791",
> + .data = (void *)&rcar_info_gen2,
> + },
> + {
> + .compatible = "renesas,vin-r8a7790",
> + .data = (void *)&rcar_info_gen2,
> + },
> + {
> + .compatible = "renesas,vin-r8a7779",
> + .data = (void *)&rcar_info_h1,
> + },
> + {
> + .compatible = "renesas,vin-r8a7778",
> + .data = (void *)&rcar_info_m1,
> + },
> + {
> + .compatible = "renesas,rcar-gen2-vin",
> + .data = (void *)&rcar_info_gen2,
> + },
> { },
> };
> MODULE_DEVICE_TABLE(of, rvin_of_id_table);
> @@ -281,7 +314,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
> return -ENODEV;
>
> vin->dev = &pdev->dev;
> - vin->chip = (enum chip_id)match->data;
> + vin->info = (const struct rvin_info *)match->data;
This cast is not needed.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html