[PATCH 1/7] drm/i915/hwmon: Add HWMON infrastructure

Dixit, Ashutosh ashutosh.dixit at intel.com
Sat Sep 24 03:54:47 UTC 2022


On Fri, 23 Sep 2022 12:56:37 -0700, Badal Nilawar wrote:
>

Hi Badal,

Let me add this comment on the latest version so we don't forget about it:

> +void i915_hwmon_register(struct drm_i915_private *i915)
> +{
> +	struct device *dev = i915->drm.dev;
> +	struct i915_hwmon *hwmon;
> +	struct device *hwmon_dev;
> +	struct hwm_drvdata *ddat;
> +
> +	/* hwmon is available only for dGfx */
> +	if (!IS_DGFX(i915))
> +		return;
> +
> +	hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);

If we are using devm_kzalloc we might as well replace all the
hwmon_device_register_with_info's (in Patch 1 and 7) with
devm_hwmon_device_register_with_info and then i915_hwmon_unregister is just
this:

void i915_hwmon_unregister(struct drm_i915_private *i915)
{
        fetch_and_zero(&i915->hwmon);
}

Even the above statement is probably not needed but might as well retain it
for sanity. So this is a simple change.

Thanks.
--
Ashutosh


More information about the dri-devel mailing list