public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/2] thermal: netlink: Add thermal_group_has_listeners() helper
Date: Wed, 27 Dec 2023 17:01:11 +0100	[thread overview]
Message-ID: <ZYxKR5P0emZfFdUo@linux.intel.com> (raw)
In-Reply-To: <7f1d54e4-5f33-41b2-8f85-b18c3abc84e9@linaro.org>

On Wed, Dec 27, 2023 at 04:40:31PM +0100, Daniel Lezcano wrote:
> On 27/12/2023 16:31, Stanislaw Gruszka wrote:
> > Hi Daniel,
> > 
> > On Wed, Dec 27, 2023 at 03:11:03PM +0100, Daniel Lezcano wrote:
> > > > +static int thermal_group_has_listeners(enum thermal_genl_multicast_groups group)
> > > > +{
> > > > +	return genl_has_listeners(&thermal_gnl_family, &init_net, group);
> > > > +}
> > > > +
> > > >   /************************** Sampling encoding *******************************/
> > > >   int thermal_genl_sampling_temp(int id, int temp)
> > > > @@ -83,6 +88,9 @@ int thermal_genl_sampling_temp(int id, int temp)
> > > >   	struct sk_buff *skb;
> > > >   	void *hdr;
> > > > +	if (!thermal_group_has_listeners(THERMAL_GENL_SAMPLING_GROUP))
> > > > +		return -ESRCH;
> > > > +
> > > 
> > > Do really want to return an error ? Shall we just bail out instead ?
> > 
> > I decided for error because thermal_notify_* are int functions and we
> > return error code for some other cases when the messages can not be
> > sent (i.e. alloc error).
> > Event if currently return value is ignored by all callers (FWICT),
> > error information could be used theoretically.
> > 
> > If returning 0 is preferable/better, I can change that.
> 
> The caller will have to handle the specific case if there is no listeners.
> There is an error if the message can not be sent but here there is no error
> related to that, just we don't send it. So having an error when there is
> nothing to do is not really an error.

Ok, will change to 0 in v2.

Regards
Stanislaw

      reply	other threads:[~2023-12-27 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 14:00 [PATCH 1/2] thermal: netlink: Add enum for mutlicast groups indexes Stanislaw Gruszka
2023-12-27 14:00 ` [PATCH 2/2] thermal: netlink: Add thermal_group_has_listeners() helper Stanislaw Gruszka
2023-12-27 14:11   ` Daniel Lezcano
2023-12-27 15:31     ` Stanislaw Gruszka
2023-12-27 15:40       ` Daniel Lezcano
2023-12-27 16:01         ` Stanislaw Gruszka [this message]

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=ZYxKR5P0emZfFdUo@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox