All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Mark Pearson <markpearson@lenovo.com>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <mgross@linux.intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>,
	"Platform Driver" <platform-driver-x86@vger.kernel.org>,
	"Bastien Nocera" <hadess@hadess.net>,
	"Barnabás Pőcze" <pobrn@protonmail.com>,
	"Mario Limonciello" <mario.limonciello@dell.com>,
	"Elia Devito" <eliadevito@gmail.com>,
	"Benjamin Berg" <bberg@redhat.com>,
	"Darren Hart" <dvhart@infradead.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH v5 2/3] ACPI: platform-profile: Add platform profile support
Date: Tue, 8 Dec 2020 19:32:54 +0100	[thread overview]
Message-ID: <CAJZ5v0g0Cof-6-rjjWKv76N1Nr7j=AOWMGX_zSb=FBvq_VuOGQ@mail.gmail.com> (raw)
In-Reply-To: <CAJZ5v0j9jZBoyvr4=2mTq1A8dc+rbUaf=Woy3PnpKh8Bbg=-RQ@mail.gmail.com>

On Tue, Dec 8, 2020 at 7:26 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Wed, Dec 2, 2020 at 6:16 PM Mark Pearson <markpearson@lenovo.com> wrote:

[cut]

> > +
> > +static ssize_t platform_profile_store(struct device *dev,
> > +                           struct device_attribute *attr,
> > +                           const char *buf, size_t count)
> > +{
> > +       int err, i;
> > +
> > +       err = mutex_lock_interruptible(&profile_lock);
> > +       if (err)
> > +               return err;
> > +
> > +       if (!cur_profile) {
> > +               mutex_unlock(&profile_lock);
> > +               return -ENODEV;
> > +       }
> > +
> > +       /* Scan for a matching profile */
> > +       i = sysfs_match_string(profile_names, buf);
> > +       if (i < 0) {
> > +               mutex_unlock(&profile_lock);
> > +               return -EINVAL;
> > +       }
> > +
> > +       /* Check that platform supports this profile choice */
> > +       if (!test_bit(i, cur_profile->choices)) {
> > +               mutex_unlock(&profile_lock);
> > +               return -EOPNOTSUPP;
> > +       }
> > +
> > +       err = cur_profile->profile_set(i);
>
> What if this gets a signal in the middle of the ->profile_set()
> execution?  Is this always guaranteed to work?

I got this backwards, sorry.

The "interruptible" variant is used to allow the waiters to be
interrupted, so I guess the concern is that ->profile_set() may get
stuck or just take too much time?

> > +       mutex_unlock(&profile_lock);
> > +       if (err)
> > +               return err;
> > +       return count;
> > +}
> > +

  reply	other threads:[~2020-12-08 18:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 17:11 [PATCH v5 1/3] Documentation: Add documentation for new platform_profile sysfs attribute Mark Pearson
2020-12-02 17:11 ` [PATCH v5 2/3] ACPI: platform-profile: Add platform profile support Mark Pearson
2020-12-08 18:26   ` Rafael J. Wysocki
2020-12-08 18:32     ` Rafael J. Wysocki [this message]
2020-12-08 18:54     ` [External] " Mark Pearson
2020-12-08 19:18       ` Rafael J. Wysocki
2020-12-08 19:47         ` Mark Pearson
2020-12-02 17:11 ` [PATCH v5 3/3] platform/x86: thinkpad_acpi: " Mark Pearson
2020-12-03  9:44 ` [PATCH v5 1/3] Documentation: Add documentation for new platform_profile sysfs attribute Hans de Goede
2020-12-07 19:29   ` Rafael J. Wysocki
2020-12-08  9:11     ` Hans de Goede
2020-12-08 10:28       ` Hans de Goede

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='CAJZ5v0g0Cof-6-rjjWKv76N1Nr7j=AOWMGX_zSb=FBvq_VuOGQ@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=bberg@redhat.com \
    --cc=dvhart@infradead.org \
    --cc=eliadevito@gmail.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mario.limonciello@dell.com \
    --cc=markpearson@lenovo.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    --cc=rjw@rjwysocki.net \
    --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 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.