On Thu, Sep 11, 2014 at 12:02:09PM -0300, Ezequiel Garcia wrote: > The current code abuses ifdefs to determine if the selected ECC scheme > is supported by the running kernel. As a result the code is hard to read, > and it also fails to load as a module. Yes, a real eyesore, with little benefit from the #ifdef's. > This commit removes all the ifdefs and instead introduces a function > omap2_nand_ecc_check() to check if the ECC is supported by using > IS_ENABLED(CONFIG_xxx). > > Since IS_ENABLED() is true when a config is =y or =m, this change fixes the > module so it can be loaded with no issues. > > Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxxxx> [...] > diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h > index 780d1e9..25d1bca 100644 > --- a/include/linux/platform_data/elm.h > +++ b/include/linux/platform_data/elm.h > @@ -42,8 +42,22 @@ struct elm_errorvec { > int error_loc[16]; > }; > > +#if IS_ENABLED(CONFIG_MTD_NAND_OMAP_BCH) > void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, > struct elm_errorvec *err_vec); > int elm_config(struct device *dev, enum bch_ecc bch_type, > int ecc_steps, int ecc_step_size, int ecc_syndrome_size); > +#else > +void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, > + struct elm_errorvec *err_vec) You should not be defining non-static functions in a header. Now these functions will be uselessly placed in every compilation unit that includes this header. You should probably make this function 'static inline'. > +{ > +} > + > +int elm_config(struct device *dev, enum bch_ecc bch_type, > + int ecc_steps, int ecc_step_size, int ecc_syndrome_size) And same here. > +{ > + return -ENOSYS; > +} > +#endif /* CONFIG_MTD_NAND_ECC_BCH */ > + > #endif /* __ELM_H */ Brian -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html