From patchwork Wed Apr 23 17:27:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 28928 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0596203AC for ; Wed, 23 Apr 2014 17:29:17 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf5126665yha.8 for ; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=UPsykojkrFMv6kaYHaq08kFbOnpL/Ai/OocXDAyWonw=; b=Xg9x6Cgw3jgyVrs68KNpsrGMw6I5ojrF5jE7jOtWZ2UyKx8/Nl67OP9XNgDx4Fs7Gu 3zqHJ4i0HwKO/zCvAmOANob1fA50ivgUwjawyCm1EM6c7dC6isKRbYyeevcjBrHMlR1A 8jk4NXpj8kg+CTupskJ5W78+qwaEP1Zjfmi4ALnIfKv2V6ceuoP2lYd1hkF7hpmhB7/r Sm360ph/6HqYo1jr+ZXeCX+EUbaxLIxzo2xMALcPsaWUzjs3QHEa7zKcF0Fz0YzTkD20 WadNJS0sQv84rZF3NaIa4nUoUAm28RpoTEkra5l8YE3TILOkXK3zq6S7NCwGxsy6JedL zxwA== X-Gm-Message-State: ALoCoQkYBo5aKJy+g4rqQyS7KxNbvKzMGPod/mruitSoKexQgeIfYjcC32ztqVgdYW2CXk+CPVj+ X-Received: by 10.224.13.12 with SMTP id z12mr24603356qaz.7.1398274157443; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.69 with SMTP id e63ls739315qgd.29.gmail; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) X-Received: by 10.52.22.74 with SMTP id b10mr108096vdf.87.1398274157316; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id h11si303450vcu.152.2014.04.23.10.29.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 10:29:17 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id id10so1504551vcb.40 for ; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) X-Received: by 10.220.105.130 with SMTP id t2mr6188523vco.18.1398274157034; Wed, 23 Apr 2014 10:29:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp120727vcb; Wed, 23 Apr 2014 10:29:16 -0700 (PDT) X-Received: by 10.14.45.6 with SMTP id o6mr64093459eeb.24.1398274156220; Wed, 23 Apr 2014 10:29:16 -0700 (PDT) Received: from flocki.atrpms.net (m.at.physik.fu-berlin.de. [160.45.254.30]) by mx.google.com with ESMTPS id t3si4148133eeg.121.2014.04.23.10.29.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Apr 2014 10:29:16 -0700 (PDT) Received-SPF: none (google.com: lm-sensors-bounces@lm-sensors.org does not designate permitted sender hosts) client-ip=160.45.254.30; Received: from localhost ([::1] helo=m.at.physik.fu-berlin.de) by flocki.atrpms.net with esmtp (Exim 4.80.1) id 1Wd0yo-0005ws-As; Wed, 23 Apr 2014 19:29:08 +0200 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by mail1.atrpms.net with esmtp (Exim 4.80.1) id 1Wd0yP-0005uQ-0Y for lm-sensors@lm-sensors.org; Wed, 23 Apr 2014 19:28:44 +0200 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 01ED613FAD1; Wed, 23 Apr 2014 12:27:17 -0500 (CDT) X-ACL-Warn: From: Pawel Moll To: Jean Delvare , Guenter Roeck Date: Wed, 23 Apr 2014 18:27:04 +0100 Message-Id: <1398274025-13618-2-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398274025-13618-1-git-send-email-pawel.moll@arm.com> References: <1398274025-13618-1-git-send-email-pawel.moll@arm.com> X-HELO-Warning: Remote host 217.140.110.23 (fw-tnat.austin.arm.com) incorrectly presented itself as collaborate-mta1.arm.com X-Scanned: No viruses found. X-Spam-Status: No (score -2.1) X-Spam-Level: -- X-Spam-Report: No (score -2.1) -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.4 AWL AWL: From: address is in the auto white-list X-Scan-Signature: 475731fd248e8814115387b9a437bf12 Cc: Pawel Moll , lm-sensors@lm-sensors.org Subject: [lm-sensors] [PATCH 1/2] hwmon: vexpress: Use legal hwmon device names X-BeenThere: lm-sensors@lm-sensors.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: lm-sensors-bounces@lm-sensors.org Errors-To: lm-sensors-bounces@lm-sensors.org X-Scanned: No viruses found. X-Spam-Status: No (score -1.8) X-Spam-Level: - X-Spam-Report: No (score -1.8) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 AWL AWL: From: address is in the auto white-list X-Scan-Signature: 0ab2abedc134dbd96d629e9ef4fc956e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pawel.moll@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The driver used to directly us a DT 'compatible' property for the 'name' attribute of the hwmon devices. Unfortunately it contains '-' which is illegal in this context. It messes up libsensors and thus every application using it. Fixed by providing equivalent (and simpler) name strings. Reported-by: Guenter Roeck Signed-off-by: Pawel Moll --- drivers/hwmon/vexpress.c | 61 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/drivers/hwmon/vexpress.c b/drivers/hwmon/vexpress.c index d867e6b..7f96905 100644 --- a/drivers/hwmon/vexpress.c +++ b/drivers/hwmon/vexpress.c @@ -27,15 +27,15 @@ struct vexpress_hwmon_data { struct device *hwmon_dev; struct vexpress_config_func *func; + const char *name; }; static ssize_t vexpress_hwmon_name_show(struct device *dev, struct device_attribute *dev_attr, char *buffer) { - const char *compatible = of_get_property(dev->of_node, "compatible", - NULL); + struct vexpress_hwmon_data *data = dev_get_drvdata(dev); - return sprintf(buffer, "%s\n", compatible); + return sprintf(buffer, "%s\n", data->name); } static ssize_t vexpress_hwmon_label_show(struct device *dev, @@ -94,6 +94,11 @@ struct attribute *vexpress_hwmon_attrs_##_name[] = { \ NULL \ } +struct vexpress_hwmon_type { + const char *name; + const struct attribute_group **attr_groups; +}; + #if !defined(CONFIG_REGULATOR_VEXPRESS) static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, @@ -102,6 +107,13 @@ static VEXPRESS_HWMON_ATTRS(volt, in1_label, in1_input); static struct attribute_group vexpress_hwmon_group_volt = { .attrs = vexpress_hwmon_attrs_volt, }; +static struct vexpress_hwmon_type vexpress_hwmon_volt = { + .name = "vexpress_volt", + .attr_groups = (const struct attribute_group *[]) { + &vexpress_hwmon_group_volt, + NULL, + }, +}; #endif static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); @@ -111,6 +123,13 @@ static VEXPRESS_HWMON_ATTRS(amp, curr1_label, curr1_input); static struct attribute_group vexpress_hwmon_group_amp = { .attrs = vexpress_hwmon_attrs_amp, }; +static struct vexpress_hwmon_type vexpress_hwmon_amp = { + .name = "vexpress_amp", + .attr_groups = (const struct attribute_group *[]) { + &vexpress_hwmon_group_amp, + NULL + }, +}; static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, @@ -119,6 +138,13 @@ static VEXPRESS_HWMON_ATTRS(temp, temp1_label, temp1_input); static struct attribute_group vexpress_hwmon_group_temp = { .attrs = vexpress_hwmon_attrs_temp, }; +static struct vexpress_hwmon_type vexpress_hwmon_temp = { + .name = "vexpress_temp", + .attr_groups = (const struct attribute_group *[]) { + &vexpress_hwmon_group_temp, + NULL + }, +}; static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, @@ -127,6 +153,13 @@ static VEXPRESS_HWMON_ATTRS(power, power1_label, power1_input); static struct attribute_group vexpress_hwmon_group_power = { .attrs = vexpress_hwmon_attrs_power, }; +static struct vexpress_hwmon_type vexpress_hwmon_power = { + .name = "vexpress_power", + .attr_groups = (const struct attribute_group *[]) { + &vexpress_hwmon_group_power, + NULL + }, +}; static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, @@ -135,26 +168,33 @@ static VEXPRESS_HWMON_ATTRS(energy, energy1_label, energy1_input); static struct attribute_group vexpress_hwmon_group_energy = { .attrs = vexpress_hwmon_attrs_energy, }; +static struct vexpress_hwmon_type vexpress_hwmon_energy = { + .name = "vexpress_energy", + .attr_groups = (const struct attribute_group *[]) { + &vexpress_hwmon_group_energy, + NULL + }, +}; static struct of_device_id vexpress_hwmon_of_match[] = { #if !defined(CONFIG_REGULATOR_VEXPRESS) { .compatible = "arm,vexpress-volt", - .data = &vexpress_hwmon_group_volt, + .data = &vexpress_hwmon_volt, }, #endif { .compatible = "arm,vexpress-amp", - .data = &vexpress_hwmon_group_amp, + .data = &vexpress_hwmon_amp, }, { .compatible = "arm,vexpress-temp", - .data = &vexpress_hwmon_group_temp, + .data = &vexpress_hwmon_temp, }, { .compatible = "arm,vexpress-power", - .data = &vexpress_hwmon_group_power, + .data = &vexpress_hwmon_power, }, { .compatible = "arm,vexpress-energy", - .data = &vexpress_hwmon_group_energy, + .data = &vexpress_hwmon_energy, }, {} }; @@ -165,6 +205,7 @@ static int vexpress_hwmon_probe(struct platform_device *pdev) int err; const struct of_device_id *match; struct vexpress_hwmon_data *data; + const struct vexpress_hwmon_type *type; data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -174,12 +215,14 @@ static int vexpress_hwmon_probe(struct platform_device *pdev) match = of_match_device(vexpress_hwmon_of_match, &pdev->dev); if (!match) return -ENODEV; + type = match->data; + data->name = type->name; data->func = vexpress_config_func_get_by_dev(&pdev->dev); if (!data->func) return -ENODEV; - err = sysfs_create_group(&pdev->dev.kobj, match->data); + err = sysfs_create_groups(&pdev->dev.kobj, type->attr_groups); if (err) goto error;