Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5013974ybl; Mon, 26 Aug 2019 20:56:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCyEe9d2k09v6LwVr5pP5wqValEKSn33NhGLQE43MH4QMgD2PNZpYllIq7ox0oRKVYHyLc X-Received: by 2002:aa7:84d7:: with SMTP id x23mr10845945pfn.53.1566878189917; Mon, 26 Aug 2019 20:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566878189; cv=none; d=google.com; s=arc-20160816; b=z2tx9wZRujzH+gN4Q5WTnqjSDv+T9mAtJYXYxpwzcYgT3ay7lulDwsAtHEfh3auJaR atWXNB6Dd5hIe40DJZ3g31FSA51l54ZyAHwf61zdrg1wGKa1aPSu+3kkWjVvXA70BDSh N7KltOSKe65kFCLkhFRNeyJozJ1HGLTDV3wJREqKwNeJJ+gyMdoufUk6PlHJxaNENAY0 aJaXn0BK4KL5lLewF8tavdajVWbv08M1o+twsPgDNXGI8JKXN9AutRtVyImufzuDb3NK aMK6mqkyAa3GJeyIJAjb0+GxII1zHxPnyTO51OGVDBNXinViIhRz6lQ5KCEOaRc/5wJA CXUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=n86x6tiC5I0Qsht6Zq4RCB06HHcgW3f4fAPr68g1RZc=; b=vl4dsrewA2g/fH0N1BXqLhvpd63IZ0MV4Ix5CFZ2VSEKPxZBHuiMYulHJ9CBbr6ePX vJbvnjKLYE9wAYDw5uciWL8ancjxROR/oEYTF/Km6/o4Jm06Z3dd+5ynkwe2SW1NO/j5 zqokt/nQtsfYG1vuHhbhB95WdENJ3zbeX0sZQ6ONEK/C5zjXQovyL1Ep+8wrWkbtoPCG Yc20K277EqoD/+oIt1F4ifVWTKgA87CBzULt9InSHXUK19GOEDWxqk5Cm4be7gqNpgUV OQyEI449FQqUdqsUWXOJ1ttfdCUx9UfLs3ehCsppTvGBulhN/7R9erx5ibquNe1AdjS8 z7ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si11770089plc.217.2019.08.26.20.56.14; Mon, 26 Aug 2019 20:56:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729082AbfH0DzP (ORCPT + 99 others); Mon, 26 Aug 2019 23:55:15 -0400 Received: from anchovy1.45ru.net.au ([203.30.46.145]:54739 "EHLO anchovy1.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728909AbfH0DzP (ORCPT ); Mon, 26 Aug 2019 23:55:15 -0400 Received: (qmail 14690 invoked by uid 5089); 27 Aug 2019 03:55:13 -0000 Received: by simscan 1.2.0 ppid: 14576, pid: 14577, t: 0.0517s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.128?) (preid@electromag.com.au@203.59.235.95) by anchovy1.45ru.net.au with ESMTPA; 27 Aug 2019 03:55:12 -0000 Subject: Re: [PATCH 4/4] iio: adc: ina2xx: Use label proper for device identification To: Jonathan Cameron , Michal Simek Cc: linux-kernel@vger.kernel.org, monstr@monstr.eu, linux@roeck-us.net, Colin Ian King , linux-iio@vger.kernel.org, =?UTF-8?Q?Stefan_Br=c3=bcns?= , Lars-Peter Clausen , Peter Meerwald-Stadler , Hartmut Knaack References: <0542b562a813c5c22c42484ac24bbb626ac3c022.1566310292.git.michal.simek@xilinx.com> <970c3988-24e4-26c2-9027-d8ff40c3a9bb@electromag.com.au> <20190825190753.7d52c3f9@archlinux> From: Phil Reid Message-ID: Date: Tue, 27 Aug 2019 11:55:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190825190753.7d52c3f9@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/08/2019 02:07, Jonathan Cameron wrote: > On Wed, 21 Aug 2019 11:12:00 +0200 > Michal Simek wrote: > >> On 21. 08. 19 4:11, Phil Reid wrote: >>> On 20/08/2019 22:11, Michal Simek wrote: >>>> Add support for using label property for easier device identification via >>>> iio framework. >>>> >>>> Signed-off-by: Michal Simek >>>> --- >>>> >>>>   drivers/iio/adc/ina2xx-adc.c | 2 +- >>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c >>>> index 7c7c63677bf4..077c54915f70 100644 >>>> --- a/drivers/iio/adc/ina2xx-adc.c >>>> +++ b/drivers/iio/adc/ina2xx-adc.c >>>> @@ -1033,7 +1033,7 @@ static int ina2xx_probe(struct i2c_client *client, >>>>       snprintf(chip->name, sizeof(chip->name), "%s-%s", >>>>            client->name, dev_name(&client->dev)); >>>>   -    indio_dev->name = chip->name; >>>> +    indio_dev->name = of_get_property(np, "label", NULL) ? : chip->name; >>>>       indio_dev->setup_ops = &ina2xx_setup_ops; >>>>         buffer = devm_iio_kfifo_allocate(&indio_dev->dev); >>>> >>> I like this personally. It'd be nice if it was a core function so >>> it could be an opt in to any iio device. >>> >>> Don't know how well received that'd be thou. >>> > I'm not particularly keen on changing the semantics of existing > ABI, but how about adding new ABI to provide this? > > /sys/bus/iio/devices/iio\:device0/label for example? > > I haven't thought about it in depth yet though. If you spin > a patch with that and the DT docs we'll be more likely to get > a view from DT maintainers if this is acceptable use of label. > I've sent "iio: core: Add optional symbolic label to device attributes" for further discussion. > Thanks > > Jonathan > >> >> Something like this? >> >> diff --git a/drivers/iio/industrialio-core.c >> b/drivers/iio/industrialio-core.c >> index 524a686077ca..d21b495d36a1 100644 >> --- a/drivers/iio/industrialio-core.c >> +++ b/drivers/iio/industrialio-core.c >> @@ -1647,6 +1647,9 @@ int __iio_device_register(struct iio_dev >> *indio_dev, struct module *this_mod) >> if (!indio_dev->dev.of_node && indio_dev->dev.parent) >> indio_dev->dev.of_node = indio_dev->dev.parent->of_node; >> >> + indio_dev->name = of_get_property(indio_dev->dev.of_node, >> "label", NULL) ? : >> + indio_dev->name; >> + >> ret = iio_check_unique_scan_index(indio_dev); >> if (ret < 0) >> return ret; >> >> >> M > > > -- Regards Phil Reid ElectroMagnetic Imaging Technology Pty Ltd Development of Geophysical Instrumentation & Software www.electromag.com.au 3 The Avenue, Midland WA 6056, AUSTRALIA Ph: +61 8 9250 8100 Fax: +61 8 9250 7100 Email: preid@electromag.com.au