Hi Kaneko-san, On Fri, Mar 30, 2018 at 5:13 AM, Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx> wrote: > Add support for R-Car D3 (r8a77995) thermal sensor. > > Signed-off-by: Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx> Thanks for your patch! > --- a/drivers/thermal/rcar_thermal.c > +++ b/drivers/thermal/rcar_thermal.c > @@ -58,10 +58,35 @@ struct rcar_thermal_common { > spinlock_t lock; > }; > > +enum rcar_thermal_type { > + RCAR_THERMAL, > + RCAR_GEN2_THERMAL, > + RCAR_GEN3_THERMAL, > +}; > + > +struct rcar_thermal_chip { > + int use_of_thermal; This can be a single bit: unsigned int use_of_thermal : 1; > + enum rcar_thermal_type type; If you would add feature bits, you can get rid of rcar_thermal_type: unsigned int has_filonoff : 1; unsigned int has_enr : 1; unsigned int needs_suspend_resume : 1; The number of interrupts can be stored here, too. > +}; > + > +static const struct rcar_thermal_chip rcar_thermal = { > + .use_of_thermal = 0, > + .type = RCAR_THERMAL, .has_filonoff = 1, .has_enr = 0, ... .nirqs = 1, > @@ -190,7 +222,8 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) > * enable IRQ > */ > if (rcar_has_irq_support(priv)) { > - rcar_thermal_write(priv, FILONOFF, 0); > + if (priv->chip->type != RCAR_GEN3_THERMAL) if (priv->chip->has_filonoff) > @@ -438,6 +471,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) > struct rcar_thermal_priv *priv; > struct device *dev = &pdev->dev; > struct resource *res, *irq; > + struct rcar_thermal_chip *chip = ((struct rcar_thermal_chip *) I don't think the cast is needed. > @@ -457,19 +493,35 @@ static int rcar_thermal_probe(struct platform_device *pdev) > pm_runtime_enable(dev); > pm_runtime_get_sync(dev); > > - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > - if (irq) { > - /* > - * platform has IRQ support. > - * Then, driver uses common registers > - * rcar_has_irq_support() will be enabled > - */ > - res = platform_get_resource(pdev, IORESOURCE_MEM, mres++); > - common->base = devm_ioremap_resource(dev, res); > - if (IS_ERR(common->base)) > - return PTR_ERR(common->base); > + for (i = 0; i < nirq; i++) { for (i = 0; i < priv->nirqs; i++) { Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx 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 devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html