aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2007-04-24 10:48:19 -0400
committerLen Brown <len.brown@intel.com>2007-04-25 02:00:27 -0400
commitb616004c70dd7f60a1477c3e9d6fddd00ee1fa37 (patch)
tree5121e2aedfcedeee676146ed9ea559a0127806c0 /drivers/misc/thinkpad_acpi.c
parenteaa7571b2d1a08873e4bdd8e6db3431df61cd9ad (diff)
ACPI: thinkpad-acpi: add sysfs support to the cmos command subdriver
Add sysfs attributes to send ThinkPad CMOS commands. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r--drivers/misc/thinkpad_acpi.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 79abc6841e30..ba749df189ab 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1743,8 +1743,30 @@ static struct ibm_struct bay_driver_data = {
1743 * CMOS subdriver 1743 * CMOS subdriver
1744 */ 1744 */
1745 1745
1746/* sysfs cmos_command -------------------------------------------------- */
1747static ssize_t cmos_command_store(struct device *dev,
1748 struct device_attribute *attr,
1749 const char *buf, size_t count)
1750{
1751 unsigned long cmos_cmd;
1752 int res;
1753
1754 if (parse_strtoul(buf, 21, &cmos_cmd))
1755 return -EINVAL;
1756
1757 res = issue_thinkpad_cmos_command(cmos_cmd);
1758 return (res)? res : count;
1759}
1760
1761static struct device_attribute dev_attr_cmos_command =
1762 __ATTR(cmos_command, S_IWUSR, NULL, cmos_command_store);
1763
1764/* --------------------------------------------------------------------- */
1765
1746static int __init cmos_init(struct ibm_init_struct *iibm) 1766static int __init cmos_init(struct ibm_init_struct *iibm)
1747{ 1767{
1768 int res;
1769
1748 vdbg_printk(TPACPI_DBG_INIT, 1770 vdbg_printk(TPACPI_DBG_INIT,
1749 "initializing cmos commands subdriver\n"); 1771 "initializing cmos commands subdriver\n");
1750 1772
@@ -1752,9 +1774,19 @@ static int __init cmos_init(struct ibm_init_struct *iibm)
1752 1774
1753 vdbg_printk(TPACPI_DBG_INIT, "cmos commands are %s\n", 1775 vdbg_printk(TPACPI_DBG_INIT, "cmos commands are %s\n",
1754 str_supported(cmos_handle != NULL)); 1776 str_supported(cmos_handle != NULL));
1777
1778 res = device_create_file(&tpacpi_pdev->dev, &dev_attr_cmos_command);
1779 if (res)
1780 return res;
1781
1755 return (cmos_handle)? 0 : 1; 1782 return (cmos_handle)? 0 : 1;
1756} 1783}
1757 1784
1785static void cmos_exit(void)
1786{
1787 device_remove_file(&tpacpi_pdev->dev, &dev_attr_cmos_command);
1788}
1789
1758static int cmos_read(char *p) 1790static int cmos_read(char *p)
1759{ 1791{
1760 int len = 0; 1792 int len = 0;
@@ -1795,6 +1827,7 @@ static struct ibm_struct cmos_driver_data = {
1795 .name = "cmos", 1827 .name = "cmos",
1796 .read = cmos_read, 1828 .read = cmos_read,
1797 .write = cmos_write, 1829 .write = cmos_write,
1830 .exit = cmos_exit,
1798}; 1831};
1799 1832
1800/************************************************************************* 1833/*************************************************************************