From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linuxppc-dev list <linuxppc-dev@ozlabs.org>
Subject: Re: [RFC] PMU: replace information ioctls and schedule for removal
Date: Mon, 12 Nov 2007 07:55:46 +1100 [thread overview]
Message-ID: <1194814546.6510.20.camel@pasglop> (raw)
In-Reply-To: <1194523351.6294.11.camel@johannes.berg>
On Thu, 2007-11-08 at 13:02 +0100, Johannes Berg wrote:
> This patch adds sysfs attributes to the PMU to allow getting
> the information on the PMU type and whether adb is present from
> there instead of via the ioctl. The ioctl is made optional and
> scheduled for removal.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
While there, maybe also expose the PMU version ?
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> Documentation/feature-removal-schedule.txt | 8 ++++++
> drivers/macintosh/Kconfig | 11 ++++++++
> drivers/macintosh/via-pmu.c | 36 +++++++++++++++++++++++++++++
> 3 files changed, 55 insertions(+)
>
> --- everything.orig/drivers/macintosh/via-pmu.c 2007-11-08 11:48:48.292846681 +0100
> +++ everything/drivers/macintosh/via-pmu.c 2007-11-08 11:48:53.112861818 +0100
> @@ -2533,10 +2533,12 @@ pmu_ioctl(struct inode * inode, struct f
> #endif /* CONFIG_INPUT_ADBHID */
> #endif /* CONFIG_PMAC_BACKLIGHT_LEGACY */
>
> +#ifdef CONFIG_DEPRECATED_PMU_INFO_IOCTLS
> case PMU_IOC_GET_MODEL:
> return put_user(pmu_kind, argp);
> case PMU_IOC_HAS_ADB:
> return put_user(pmu_has_adb, argp);
> +#endif
> }
> return error;
> }
> @@ -2680,6 +2682,39 @@ static int pmu_sys_resume(struct sys_dev
>
> #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
>
> +static ssize_t show_kind(struct sys_device *sysdev, char *buf)
> +{
> + return sprintf(buf, "%d\n", pmu_kind);
> +}
> +
> +static ssize_t show_has_adb(struct sys_device *sysdev, char *buf)
> +{
> + return sprintf(buf, "%d\n", pmu_has_adb);
> +}
> +
> +static SYSDEV_ATTR(kind, 0444, show_kind, NULL);
> +static SYSDEV_ATTR(has_adb, 0444, show_has_adb, NULL);
> +
> +int pmu_sys_add(struct sys_device *sysdev)
> +{
> + int err;
> +
> + err = sysdev_create_file(sysdev, &attr_kind);
> + if (err)
> + goto out;
> +
> + err = sysdev_create_file(sysdev, &attr_has_adb);
> + if (err)
> + goto out_remove_kind;
> +
> + return 0;
> +
> + out_remove_kind:
> + sysdev_remove_file(sysdev, &attr_kind);
> + out:
> + return err;
> +}
> +
> static struct sysdev_class pmu_sysclass = {
> set_kset_name("pmu"),
> };
> @@ -2693,6 +2728,7 @@ static struct sysdev_driver driver_pmu =
> .suspend = &pmu_sys_suspend,
> .resume = &pmu_sys_resume,
> #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
> + .add = &pmu_sys_add,
> };
>
> static int __init init_pmu_sysfs(void)
> --- everything.orig/Documentation/feature-removal-schedule.txt 2007-11-08 11:47:39.502844564 +0100
> +++ everything/Documentation/feature-removal-schedule.txt 2007-11-08 11:48:53.122870607 +0100
> @@ -342,3 +342,11 @@ Why: This driver has been marked obsolet
> Who: Stephen Hemminger <shemminger@linux-foundation.org>
>
> ---------------------------
> +
> +What: /dev/pmu information ioctls
> +When: January 2010
> +Files: drivers/macintosh/via-pmu.c
> +Why: The PMU information can be obtained from sysfs now.
> +Who: Johannes Berg <johannes@sipsolutions.net>
> +
> +---------------------------
> --- everything.orig/drivers/macintosh/Kconfig 2007-11-08 11:47:39.422844727 +0100
> +++ everything/drivers/macintosh/Kconfig 2007-11-08 11:48:53.122870607 +0100
> @@ -87,6 +87,17 @@ config ADB_PMU
> this device; you should do so if your machine is one of those
> mentioned above.
>
> +config DEPRECATED_PMU_INFO_IOCTLS
> + bool "Support deprecated PMU information ioctl"
> + depends on ADB_PMU
> + default y
> + help
> + The PMU ioctl supports getting information on the type of PMU and
> + whether an ADB is present. This information is also available in
> + sysfs so this ioctl is no longer needed.
> +
> + If in doubt, say Y even if you will not use the ioctl.
> +
> config ADB_PMU_LED
> bool "Support for the Power/iBook front LED"
> depends on ADB_PMU
>
next prev parent reply other threads:[~2007-11-11 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 12:02 [RFC] PMU: replace information ioctls and schedule for removal Johannes Berg
2007-11-11 20:55 ` Benjamin Herrenschmidt [this message]
2007-11-12 16:33 ` Johannes Berg
2007-11-12 23:15 ` Paul Mackerras
2007-11-13 13:20 ` Johannes Berg
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=1194814546.6510.20.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=johannes@sipsolutions.net \
--cc=linuxppc-dev@ozlabs.org \
/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;
as well as URLs for NNTP newsgroup(s).