On Tue, Sep 10, 2024 at 01:58:29PM GMT, Raag Jadav wrote: > On Tue, Sep 10, 2024 at 11:57:20AM +0530, Nilawar, Badal wrote: > > On 10-09-2024 10:07, Gupta, Anshuman wrote: > > > > > > > > ... > > > > > > > > > +static int > > > > > +hwm_temp_read(struct hwm_drvdata *ddat, u32 attr, long *val) { > > > > > + struct i915_hwmon *hwmon = ddat->hwmon; > > > > > + intel_wakeref_t wakeref; > > > > > + u32 reg_val; > > > > > + > > > > > + switch (attr) { > > > > > + case hwmon_temp_input: > > > > > + with_intel_runtime_pm(ddat->uncore->rpm, wakeref) > > > > > + reg_val = intel_uncore_read(ddat->uncore, hwmon- > > > > > rg.pkg_temp); > > > > > + > > > > > + /* HW register value is in degrees, convert to millidegrees. */ > > > > > + *val = REG_FIELD_GET(TEMP_MASK, reg_val) * > > > > MILLIDEGREE_PER_DEGREE; > > > > > + return 0; > > > > > + default: > > > > > + return -EOPNOTSUPP; > > > > > + } > > > > > > > > I don't understand this love for single case switches. > > > IMHO this is kept to keep symmetry in this file to make it more readable. > > > Also it readable to return error using default case, which is followed in this entire file. > > I agree on this. Let’s stick to file-wide approach and ensure it is applied > > to the fan_input attribute as well. > > Since fan patch is already on its way to drm-next, you can submit a fix if you wish. > Although I don't agree with it, I have no objections. nack! :-) It doesn't make much sense to send a controvertial patch that refactors good working code to other good (some would say worse) working code without any functional change. Thanks, Andi