On 24.08.2014 06:11, Alec Ari wrote: > Based against 3.17-rc1 > > Makes POWER_SUPPLY HWMON and BACKLIGHT_CLASS_DEVICE optional Please send a patch generated by git format-patch, preferably sent by git sen-email. > @@ -653,9 +655,11 @@ static int radeon_hwmon_init(struct radeon_device *rdev) > case THERMAL_TYPE_KV: > if (rdev->asic->pm.get_temperature == NULL) > return err; > + #ifdef CONFIG_HWMON > rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, > "radeon", rdev, > hwmon_groups); > + #endif > if (IS_ERR(rdev->pm.int_hwmon_dev)) { > err = PTR_ERR(rdev->pm.int_hwmon_dev); > dev_err(rdev->dev, #ifdef and #endif need to be at the start of the line. > @@ -669,11 +673,13 @@ static int radeon_hwmon_init(struct radeon_device *rdev) > return err; > } > > +#ifdef CONFIG_HWMON > static void radeon_hwmon_fini(struct radeon_device *rdev) > { > if (rdev->pm.int_hwmon_dev) > hwmon_device_unregister(rdev->pm.int_hwmon_dev); > } > +#endif > > static void radeon_dpm_thermal_work_handler(struct work_struct *work) > { > @@ -1398,8 +1404,9 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) > device_remove_file(rdev->dev, &dev_attr_power_profile); > device_remove_file(rdev->dev, &dev_attr_power_method); > } > - > + #ifdef CONFIG_HWMON > radeon_hwmon_fini(rdev); > + #endif > kfree(rdev->pm.power_state); > } > > @@ -1417,8 +1424,9 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) > device_remove_file(rdev->dev, &dev_attr_power_method); > } > radeon_dpm_fini(rdev); > - > + #ifdef CONFIG_HWMON > radeon_hwmon_fini(rdev); > + #endif > kfree(rdev->pm.power_state); > } > Might be better to move the guard inside radeon_hwmon_fini() than to guard it at every call site. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel