From: Raag Jadav <raag.jadav@intel.com>
To: "Nilawar, Badal" <badal.nilawar@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>
Cc: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tursulin@ursulin.net, airlied@gmail.com,
daniel@ffwll.ch, linux@roeck-us.net,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
anshuman.gupta@intel.com, riana.tauro@intel.com,
ashutosh.dixit@intel.com, karthik.poosa@intel.com,
andriy.shevchenko@linux.intel.com
Subject: Re: [PATCH v4] drm/i915/hwmon: expose fan speed
Date: Mon, 19 Aug 2024 09:50:13 +0300 [thread overview]
Message-ID: <ZsLrJVdBmfZhZaaR@black.fi.intel.com> (raw)
In-Reply-To: <88320f60-d55b-4aa5-881f-530375659c27@intel.com>
On Wed, Aug 14, 2024 at 02:07:44PM +0530, Nilawar, Badal wrote:
>
> Hi Andi,
>
> On 09-08-2024 15:46, Andi Shyti wrote:
> > Hi Badal,
> >
> > > > +static int
> > > > +hwm_fan_read(struct hwm_drvdata *ddat, u32 attr, long *val)
> > > > +{
> > > > + struct i915_hwmon *hwmon = ddat->hwmon;
> > > > + struct hwm_fan_info *fi = &ddat->fi;
> > > > + u32 reg_val, pulses, time, time_now;
> > > > + intel_wakeref_t wakeref;
> > > > + long rotations;
> > > > + int ret = 0;
> > > > +
> > > > + if (attr != hwmon_fan_input)
> > > > + return -EOPNOTSUPP;
> > > Using a switch case in rev3 is more logical here. It will also simplify
> > > adding more fan attributes in the future. This is why switch cases are used
> > > in other parts of the file.
> >
> > it was my suggestion and to be honest I would rather prefer it
> > this way. I can understand it if we were expecting more cases in
> > the immediate, like it was in your case.
> >
> > But I wouldn't have an ugly and unreadable one-case-switch in the
> > eventuality that something comes in the future. In that case, we
> > can always convert it.
>
> My rationale for suggesting a switch case is that in the current alignment
> hwm_XX_read() function is designed to handle all possible/supported
> attributes of the XX sensor type.
> With the proposed change, hwm_fan_read() would only manage the
> hwmon_fan_input attribute.
> If a single switch case isn’t preferred, I would recommend creating a helper
> function dedicated to hwmon_fan_input.
>
> hwm_fan_read()
> {
> if (attr == hwmon_fan_input)
> return helper(); //hwmon_fan_input_read()
> return -EOPNOTSUPP;
> }
Hi Andi,
If you agree with this, please let me know.
Will send out a v6 accordingly.
Raag
next prev parent reply other threads:[~2024-08-19 6:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 6:15 [PATCH v4] drm/i915/hwmon: expose fan speed Raag Jadav
2024-08-09 6:54 ` ✓ Fi.CI.BAT: success for drm/i915/hwmon: expose fan speed (rev4) Patchwork
2024-08-09 9:33 ` [PATCH v4] drm/i915/hwmon: expose fan speed Nilawar, Badal
2024-08-09 10:10 ` Raag Jadav
2024-08-09 10:16 ` Andi Shyti
2024-08-14 8:37 ` Nilawar, Badal
2024-08-19 6:50 ` Raag Jadav [this message]
2024-08-19 15:22 ` Andi Shyti
2024-08-09 11:48 ` Andy Shevchenko
2024-08-09 11:57 ` Andi Shyti
2024-08-20 9:00 ` Raag Jadav
2024-08-20 21:49 ` Rodrigo Vivi
2024-08-21 3:52 ` Raag Jadav
2024-08-21 11:39 ` Andy Shevchenko
2024-08-21 11:38 ` Andy Shevchenko
2024-08-09 14:55 ` Raag Jadav
2024-08-13 11:23 ` Raag Jadav
2024-08-13 11:47 ` Andy Shevchenko
2024-08-13 12:53 ` Raag Jadav
2024-08-13 13:07 ` Andy Shevchenko
2024-08-10 16:53 ` ✗ Fi.CI.IGT: failure for drm/i915/hwmon: expose fan speed (rev4) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZsLrJVdBmfZhZaaR@black.fi.intel.com \
--to=raag.jadav@intel.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anshuman.gupta@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=badal.nilawar@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=karthik.poosa@intel.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tursulin@ursulin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.