From: tip-bot for Vivien Didelot <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
vivien.didelot@savoirfairelinux.com, hpa@zytor.com,
mingo@kernel.org, kernel@savoirfairelinux.com,
tglx@linutronix.de
Subject: [tip:x86/platform] x86/platform/ts5500: Add a 'name' sysfs attribute
Date: Wed, 16 Jul 2014 12:45:43 -0700 [thread overview]
Message-ID: <tip-84e288d41871cfb7a21cb7e6dee9e3884b59b25f@git.kernel.org> (raw)
In-Reply-To: <1404860269-11837-3-git-send-email-vivien.didelot@savoirfairelinux.com>
Commit-ID: 84e288d41871cfb7a21cb7e6dee9e3884b59b25f
Gitweb: http://git.kernel.org/tip/84e288d41871cfb7a21cb7e6dee9e3884b59b25f
Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
AuthorDate: Tue, 8 Jul 2014 18:57:48 -0400
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 16 Jul 2014 21:17:41 +0200
x86/platform/ts5500: Add a 'name' sysfs attribute
Add a new "name" attribute to the TS5500 sysfs group, to clarify
which supported board model it is.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Savoir-faire Linux Inc. <kernel@savoirfairelinux.com>
Link: http://lkml.kernel.org/r/1404860269-11837-3-git-send-email-vivien.didelot@savoirfairelinux.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
Documentation/ABI/testing/sysfs-platform-ts5500 | 7 +++++++
arch/x86/platform/ts5500/ts5500.c | 23 ++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-platform-ts5500 b/Documentation/ABI/testing/sysfs-platform-ts5500
index c88375a..e685957 100644
--- a/Documentation/ABI/testing/sysfs-platform-ts5500
+++ b/Documentation/ABI/testing/sysfs-platform-ts5500
@@ -30,6 +30,13 @@ Description:
the corresponding bit is set. For instance, 0x0e means jumpers
2, 3 and 4 are set.
+What: /sys/devices/platform/ts5500/name
+Date: July 2014
+KernelVersion: 3.16
+Contact: "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com>
+Description:
+ Model name of the TS board, e.g. "TS-5500".
+
What: /sys/devices/platform/ts5500/rs485
Date: January 2013
KernelVersion: 3.7
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c
index 1bbf17b..4eb8eea 100644
--- a/arch/x86/platform/ts5500/ts5500.c
+++ b/arch/x86/platform/ts5500/ts5500.c
@@ -1,7 +1,7 @@
/*
* Technologic Systems TS-5500 Single Board Computer support
*
- * Copyright (C) 2013 Savoir-faire Linux Inc.
+ * Copyright (C) 2013-2014 Savoir-faire Linux Inc.
* Vivien Didelot <vivien.didelot@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify it under
@@ -66,6 +66,7 @@
/**
* struct ts5500_sbc - TS-5500 board description
+ * @name: Board model name.
* @id: Board product ID.
* @sram: Flag for SRAM option.
* @rs485: Flag for RS-485 option.
@@ -75,6 +76,7 @@
* @jumpers: Bitfield for jumpers' state.
*/
struct ts5500_sbc {
+ const char *name;
int id;
bool sram;
bool rs485;
@@ -122,13 +124,14 @@ static int __init ts5500_detect_config(struct ts5500_sbc *sbc)
if (!request_region(TS5500_PRODUCT_CODE_ADDR, 4, "ts5500"))
return -EBUSY;
- tmp = inb(TS5500_PRODUCT_CODE_ADDR);
- if (tmp != TS5500_PRODUCT_CODE) {
- pr_err("This platform is not a TS-5500 (found ID 0x%x)\n", tmp);
+ sbc->id = inb(TS5500_PRODUCT_CODE_ADDR);
+ if (sbc->id == TS5500_PRODUCT_CODE) {
+ sbc->name = "TS-5500";
+ } else {
+ pr_err("ts5500: unknown product code 0x%x\n", sbc->id);
ret = -ENODEV;
goto cleanup;
}
- sbc->id = tmp;
tmp = inb(TS5500_SRAM_RS485_ADC_ADDR);
sbc->sram = tmp & TS5500_SRAM;
@@ -147,6 +150,15 @@ cleanup:
return ret;
}
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct ts5500_sbc *sbc = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%s\n", sbc->name);
+}
+static DEVICE_ATTR_RO(name);
+
static ssize_t id_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -183,6 +195,7 @@ TS5500_ATTR_BOOL(itr);
static struct attribute *ts5500_attributes[] = {
&dev_attr_id.attr,
+ &dev_attr_name.attr,
&dev_attr_jumpers.attr,
&dev_attr_sram.attr,
&dev_attr_rs485.attr,
next prev parent reply other threads:[~2014-07-16 19:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 22:57 [PATCH 0/3] Add support for Technologic Systems TS-5400 Vivien Didelot
2014-07-08 22:57 ` [PATCH 1/3] x86: (ts5500) use DEVICE_ATTR_RO macro Vivien Didelot
2014-07-16 19:45 ` [tip:x86/platform] x86/platform/ts5500: Use the DEVICE_ATTR_RO() macro tip-bot for Vivien Didelot
2014-07-08 22:57 ` [PATCH 2/3] x86: (ts5500) add a name attribute Vivien Didelot
2014-07-16 19:45 ` tip-bot for Vivien Didelot [this message]
2014-07-08 22:57 ` [PATCH 3/3] x86: (ts5500) add support for TS-5400 Vivien Didelot
2014-07-16 19:45 ` [tip:x86/platform] x86/platform/ts5500: Add support for TS-5400 boards tip-bot for Vivien Didelot
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=tip-84e288d41871cfb7a21cb7e6dee9e3884b59b25f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=vivien.didelot@savoirfairelinux.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