All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Barnabás Pőcze" <pobrn@protonmail.com>
To: Mark Pearson <markpearson@lenovo.com>
Cc: "rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"mgross@linux.intel.com" <mgross@linux.intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"mario.limonciello@dell.com" <mario.limonciello@dell.com>,
	"eliadevito@gmail.com" <eliadevito@gmail.com>,
	"hadess@hadess.net" <hadess@hadess.net>,
	"bberg@redhat.com" <bberg@redhat.com>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	"dvhart@infradead.org" <dvhart@infradead.org>
Subject: Re: [External] Re: [PATCH v3] ACPI: platform-profile: Add platform profile support
Date: Mon, 16 Nov 2020 10:24:32 +0000	[thread overview]
Message-ID: <V-4DMCmZGmDmzaFHHwDhxqTzfNm25SyViOwvoJKvAUytgpL2XlM5u9GZy5AOfxN0r0QjSoCBFt5PQvUtbVRUQQE8oiRzB2j_HGM7U_4s304=@protonmail.com> (raw)
In-Reply-To: <3bdd8da6-a47a-fbc6-de0e-858f493a226e@lenovo.com>

Hi


2020. november 16., hétfő 0:04 keltezéssel, Mark Pearson írta:

> [...]
> >> +static ssize_t platform_profile_store(struct device *dev,
> >> +			    struct device_attribute *attr,
> >> +			    const char *buf, size_t count)
> >> +{
> >> +	int err, i;
> >> +
> >> +	mutex_lock(&profile_lock);
> >> +	if (!cur_profile) {
> >> +		mutex_unlock(&profile_lock);
> >> +		return -EOPNOTSUPP;
> >
> > I'm not sure why you modified the errno. ENODEV seemed to me like a perfectly
> > fine error to return if `cur_profile` is not set. `platform_profile_choices_show()`
> > returns ENODEV, so there is a bit of inconsistency.
> > (same applies to `platform_profile_show()`)
> My thinking was it seemed a better message. I can't really see any
> conditions when you'd get here (a driver would have registered a driver
> and then not provided a profile?) but it seemed that if that was
> possible it was more because changing the settings wasn't supported.
>
> I managed to convince myself it made more sense - but have no issue with
> changing it back.
> >
> >
> >> +	}
> >> +
> >> +	/* Scan for a matching profile */
> >> +	i = sysfs_match_string(profile_names, buf);
> >> +	if (i < 0) {
> >> +		mutex_unlock(&profile_lock);
> >> +		return -EINVAL;
> >> +	}
> >> +
> >> +	if (!cur_profile->profile_set) {
> >> +		mutex_unlock(&profile_lock);
> >> +		return -EOPNOTSUPP;
> >> +	}
> >> +

One thing I have just noticed is that I believe the selected profile should be
checked against `cur_profile->choices`, don't you think? I have assumed for
some reason that this check is done, and `profile_set` is only called with values
that the handler supports (they are in `choices`) up until now, but I see
that that's not what's happening.


> >> +	err = cur_profile->profile_set(i);
> >> +	mutex_unlock(&profile_lock);
> >> +	if (err)
> >> +		return err;
> >> +
> >> +	return count;
> >> +}
> [...]
> >> diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
> >> new file mode 100644
> >> index 000000000000..f6592434c8ce
> >> --- /dev/null
> >> +++ b/include/linux/platform_profile.h
> >> @@ -0,0 +1,36 @@
> [...]
> >
> > By the way, I still feel like the enum values are "too vague" and should be
> > prefixed with `platform_`. If you're not opposed to that change.
> Sure - I can change that. For me it made the names long but I don't mind
> changing them.

Short and succinct names a good, but I hope you can see why I'm saying what I'm
saying. I believe these names should be "properly namespaced" since they are in
a "kernel-global" header file.


> >
> >
> >> +};
> >> +
> >> [...]


Regards,
Barnabás Pőcze

  reply	other threads:[~2020-11-16 11:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15  0:44 [PATCH v3] ACPI: platform-profile: Add platform profile support Mark Pearson
2020-11-15 18:26 ` Barnabás Pőcze
2020-11-15 23:04   ` [External] " Mark Pearson
2020-11-16 10:24     ` Barnabás Pőcze [this message]
2020-11-16 15:25       ` Mark Pearson
2020-11-16 14:33     ` Hans de Goede
2020-11-16 15:19       ` Mark Pearson
2020-11-20 19:50 ` Barnabás Pőcze
2020-11-21  4:14   ` [External] " Mark Pearson
2020-11-21 14:27   ` Hans de Goede
2020-11-21 21:18     ` Barnabás Pőcze
2020-11-22  9:32       ` Hans de Goede
2020-11-24 15:30     ` Bastien Nocera
2020-11-25 16:42       ` Hans de Goede
2020-11-25 19:41         ` [External] " Mark Pearson
2020-11-25 22:32           ` Bastien Nocera
2020-11-26 10:36             ` 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='V-4DMCmZGmDmzaFHHwDhxqTzfNm25SyViOwvoJKvAUytgpL2XlM5u9GZy5AOfxN0r0QjSoCBFt5PQvUtbVRUQQE8oiRzB2j_HGM7U_4s304=@protonmail.com' \
    --to=pobrn@protonmail.com \
    --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=rjw@rjwysocki.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.