Re: [PATCH 1/1] thermal: fix compilation issue on CONFIG_THERMAL_OF dependencies

From: Jean Delvare
Date: Tue Jan 07 2014 - 10:04:18 EST


On Tue, 07 Jan 2014 06:33:46 -0800, Guenter Roeck wrote:
> Alternative would be something like
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index f7e11c7..156bb4d 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -244,7 +244,7 @@ struct thermal_genl_event {
> };
>
> /* Function declarations */
> -#ifdef CONFIG_THERMAL_OF
> +#if defined(CONFIG_THERMAL_OF) && (defined(CONFIG_THERMAL) || (defined(MODULE) && defined(CONFIG_THERMAL_MODULE)))
> struct thermal_zone_device *
> thermal_zone_of_sensor_register(struct device *dev, int id,
> void *data, int (*get_temp)(void *, long *),

I don't like it. Using defined(MODULE) in a header file seems quite
risky (although I see there are occurrences of this already.) But more
importantly, this means that you can have all pieces enabled in your
kernel but the code will be silently stubbed out because the
combinations of Y and M happens to be unsupported but this is nowhere
documented. This is wrong.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/