Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932780AbbD0MPA (ORCPT ); Mon, 27 Apr 2015 08:15:00 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:43365 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752972AbbD0MNm (ORCPT ); Mon, 27 Apr 2015 08:13:42 -0400 X-AuditID: cbfee68f-f793b6d000005f66-89-553e27f3449d From: Chanwoo Choi To: linux-kernel@vger.kernel.org Cc: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, ckeepax@opensource.wolfsonmicro.com, cw00.choi@samsung.com Subject: [PATCH 1/4] extcon: Modify the device name as extcon[X] for sysfs Date: Mon, 27 Apr 2015 21:13:35 +0900 Message-id: <1430136818-11657-2-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.5.5 In-reply-to: <1430136818-11657-1-git-send-email-cw00.choi@samsung.com> References: <1430136818-11657-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsWyRsSkWPezul2oweVrchb/ptxgt7j+5Tmr xdmmN+wWl3fNYbO43biCzYHV4+XE32wefVtWMXp83iQXwBzFZZOSmpNZllqkb5fAlTF75zXm gtO8FcunCTcwLuHuYuTkkBAwkTh2ZSEzhC0mceHeerYuRi4OIYGljBKTv88CcjjAippm5EPE pzNKtO1ZwAjhfGGUaF/cwwrSzSagJbH/xQ02EFtEQEFic+8zsDizQKnE5r6nYHFhAS+J2R29 YNtYBFQlnm+4xQhi8wq4Stw9e4wd4goFiWXLZ4L1cgq4SbxbewysRgiopvfILmaQxRICv9kk dj24DDVIQOLb5EMsEJfKSmw6APWNpMTBFTdYJjAKL2BkWMUomlqQXFCclF5krFecmFtcmpeu l5yfu4kRGLyn/z3r38F494D1IUYBDkYlHl6JibahQqyJZcWVuYcYTYE2TGSWEk3OB8ZIXkm8 obGZkYWpiamxkbmlmZI470K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VSizFGYmGWsxFxYkA3M8cFKMCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1932 Lines: 57 This patch modify the device name as extcon[X] for sysfs by using the 'extcon' prefix word instead of separate device name. On user-space aspect, user would find the some extcon drvier with extcon[X] pattern. So, this patch modify the device name as following: - /sys/class/extcon/[device name] -> /sys/class/extcon/extcon[X] Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 4c9f165..1a93229 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -163,7 +163,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, return ret; } - return sprintf(buf, "%s\n", dev_name(&edev->dev)); + return sprintf(buf, "%s\n", edev->name); } static DEVICE_ATTR_RO(name); @@ -701,6 +701,7 @@ EXPORT_SYMBOL_GPL(devm_extcon_dev_free); int extcon_dev_register(struct extcon_dev *edev) { int ret, index = 0; + static atomic_t edev_no = ATOMIC_INIT(-1); if (!extcon_class) { ret = create_extcon_class(); @@ -725,13 +726,14 @@ int extcon_dev_register(struct extcon_dev *edev) edev->dev.class = extcon_class; edev->dev.release = extcon_dev_release; - edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); + edev->name = dev_name(edev->dev.parent); if (IS_ERR_OR_NULL(edev->name)) { dev_err(&edev->dev, "extcon device name is null\n"); return -EINVAL; } - dev_set_name(&edev->dev, "%s", edev->name); + dev_set_name(&edev->dev, "extcon%lu", + (unsigned long)atomic_inc_return(&edev_no)); if (edev->max_supported) { char buf[10]; -- 1.8.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/