Message ID | 1400757848-18075-10-git-send-email-lee.jones@linaro.org |
---|---|
State | New |
Headers | show |
On Thursday 22 May 2014 12:24:07 Lee Jones wrote: > + /* Mask to apply on boot_device_reg */ > + ret = of_property_read_u32(np, "st,boot-device-msk", &boot_device_msk); > + if (ret) > + goto boot_device_fail; > + > The binding defines this property as "optional", but the driver fails here if it's not provided. I suggest you add a default value here so you can deal with existing dts. The default should be documented in the binding as well. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
> On Thursday 22 May 2014 12:24:07 Lee Jones wrote: > > + /* Mask to apply on boot_device_reg */ > > + ret = of_property_read_u32(np, "st,boot-device-msk", &boot_device_msk); > > + if (ret) > > + goto boot_device_fail; > > + > > > > The binding defines this property as "optional", but the driver fails > here if it's not provided. I suggest you add a default value here so you > can deal with existing dts. The default should be documented in > the binding as well. The property is optional. It doesn't fail completely, merely skips the boot device check and falls back to using SPI. I can update the documentation to this effect though, no problem.
On Thursday 22 May 2014 12:52:16 Lee Jones wrote: > > On Thursday 22 May 2014 12:24:07 Lee Jones wrote: > > > + /* Mask to apply on boot_device_reg */ > > > + ret = of_property_read_u32(np, "st,boot-device-msk", &boot_device_msk); > > > + if (ret) > > > + goto boot_device_fail; > > > + > > > > > > > The binding defines this property as "optional", but the driver fails > > here if it's not provided. I suggest you add a default value here so you > > can deal with existing dts. The default should be documented in > > the binding as well. > > The property is optional. It doesn't fail completely, merely skips the > boot device check and falls back to using SPI. I can update the > documentation to this effect though, no problem. Ah, I see, thanks for the explanation! Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 3f74e125..6d535d9 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2125,6 +2125,7 @@ static void stfsm_fetch_platform_configs(struct platform_device *pdev) struct regmap *regmap; uint32_t boot_device_reg; uint32_t boot_device_spi; + uint32_t boot_device_msk; uint32_t boot_device; /* Value we read from *boot_device_reg */ int ret; @@ -2149,10 +2150,17 @@ static void stfsm_fetch_platform_configs(struct platform_device *pdev) if (ret) goto boot_device_fail; + /* Mask to apply on boot_device_reg */ + ret = of_property_read_u32(np, "st,boot-device-msk", &boot_device_msk); + if (ret) + goto boot_device_fail; + ret = regmap_read(regmap, boot_device_reg, &boot_device); if (ret) goto boot_device_fail; + boot_device &= boot_device_msk; + if (boot_device != boot_device_spi) fsm->booted_from_spi = false;