Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2143861rwb; Sun, 4 Sep 2022 09:11:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dNxHGaXLCFNu500DVklba7IUaR/9iRRECkIJEwctw5kfX+UTxV6mYYDl0i7SbJr2pOmI3 X-Received: by 2002:a17:90a:940d:b0:1fe:39c5:4ce1 with SMTP id r13-20020a17090a940d00b001fe39c54ce1mr15607664pjo.74.1662307904721; Sun, 04 Sep 2022 09:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662307904; cv=none; d=google.com; s=arc-20160816; b=XQT0eRZVC/YC5Dm8tJoiqusqXuh1Lx0u3q0tEyZLFYZqYZDRUOkL7IzbEfXvzd7cze Sx5rUXfIY2+k23jBDX+tdqJNvtDWWQfexxPrktW6vIw/gRTnmEu+v+HPGyCYOR4XY9Lv +xUb+dRXdU0NG9k7WGzJV7mRHKxJ4l1ax2x3l2h0tBjyjS8EIL+fuQWFSb52g9d54dul ta0Sm/eqeE7UYdlI8ZD+636buqj3b1f+QVRw/Iy1nyghRFWepY6GiecPsNsWaq3Uf35r O690AL3z6deql5YcGks1ipRwUQ5tte+rjGcqu1YFwBHB6IA2acUuA9bt8xF3IemR0tkv QsDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Bl2iRcueIIWwFYv4p/Qh+RMTJdI9pEeQJKep9t1QDok=; b=B/Jiiar0rI7ZwgyKxv/92IIlOm7LHgX733Ve00sPihGLcwNUy6PnWq04ujrP5A3LF+ CLAMpx/WuZWTg1cS/9PGSLBIX2kV4PVoQFnoogCPedzfGmZbwkGZlVvX7vZBRlMfXemb hEJR1HHpIYDX4pr3p0iksAFfGXIPsLjfQGs1APm+pt+wlPgb4avxeiPwHkeSWRrxTNX3 GbCLzHLBsGhrOwOBsucagbJXOUVomtybMohS46FPPKWjzzp0w7Sl31wwSi7ZPMpcGhnl HupvLJbGZRXzgiFyNddQK9SCyzYgBed/5WQs/doRAY12lb3DC2zTH7PhZlgGLZVzD12W zkCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ntvXgUAy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902eb9200b00172aa1ed560si7124540plg.138.2022.09.04.09.11.30; Sun, 04 Sep 2022 09:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ntvXgUAy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234143AbiIDPoD (ORCPT + 99 others); Sun, 4 Sep 2022 11:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiIDPoB (ORCPT ); Sun, 4 Sep 2022 11:44:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 117B2357DD; Sun, 4 Sep 2022 08:43:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5222460C01; Sun, 4 Sep 2022 15:43:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A5DFC433D6; Sun, 4 Sep 2022 15:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662306238; bh=CSx9D8U7zeLdj+S2jR8ebHyZgl/+lsPzYuJJygOC9Dk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ntvXgUAynAgToZ5zloMz/8fSdopBqHKe9bllfCGSkwrONgQSW63aVtrVAMA1L3qqN 8FW3uaTP9x6VpgJjro1SR1P0UBxeularKr05KruHPyFDmInFKRtc10IHnpVB02fi0h fgGEv5tytEAr69uzXtIjR6vgQVYEyhxJlO4xXvtW7iLsq5LmMS5fxYrWpQGfEXdI6o 9EXDF+RL3inckXqis8UzkiayHN+gmg0QxEEWMay7bKFFeaTt/KSzewlu88wcoP+BeO iJHmlNqLJbaKXpuWn2CKrmi9eUM8b2AzT8oeLRxEfSQvF3LyP6NCN060wCbwZ9TLi9 yHS7t+pu35Nxw== Date: Sun, 4 Sep 2022 16:09:51 +0100 From: Jonathan Cameron To: Ciprian Regus Cc: , , , , Subject: Re: [PATCH v2 5/5] drivers: iio: adc: Rename the LTC2499 iio device Message-ID: <20220904160951.7de30240@jic23-huawei> In-Reply-To: <20220901121700.1325733-5-ciprian.regus@analog.com> References: <20220901121700.1325733-1-ciprian.regus@analog.com> <20220901121700.1325733-5-ciprian.regus@analog.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Sep 2022 15:17:00 +0300 Ciprian Regus wrote: > Set the iio device's name based on the chip used for the > LTC2499 only. The most common way for IIO clients to interact > with a device is to address it based on it's name. By using > the dev_name() function, the name will be set based on a > i2c_client's kobj name, which has the format i2c_instance-i2c_address > (1-0076 for example). This is not ideal, since it makes a > requirement for userspace to have knowledge about the hardware > connections of the device. > > The name field is set to NULL for the LTC2497 and LTC2496, so > that the old name can kept as it is, since changing it will > result in an ABI breakage. > > Signed-off-by: Ciprian Regus Other than the issue with the split between patches 4 and 5 that the robot found this looks good to me. Jonathan > --- > changes in v2: > - updated the patch title (LTC249x -> LTC2499), since the name change only > affects the LTC2499. > - updated the commit description to better explain what is being done. > - only changed the iio_dev's name for the LTC2499. > - added a comment to explain difference in naming. > - added the const qualifier to the name field. > drivers/iio/adc/ltc2496.c | 1 + > drivers/iio/adc/ltc2497-core.c | 10 +++++++++- > drivers/iio/adc/ltc2497.h | 1 + > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/ltc2496.c b/drivers/iio/adc/ltc2496.c > index bf89d5ae19af..2593fa4322eb 100644 > --- a/drivers/iio/adc/ltc2496.c > +++ b/drivers/iio/adc/ltc2496.c > @@ -89,6 +89,7 @@ static void ltc2496_remove(struct spi_device *spi) > > static const struct ltc2497_chip_info ltc2496_info = { > .resolution = 16, > + .name = NULL, > }; > > static const struct of_device_id ltc2496_of_match[] = { > diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c > index b2752399402c..f52d37af4d1f 100644 > --- a/drivers/iio/adc/ltc2497-core.c > +++ b/drivers/iio/adc/ltc2497-core.c > @@ -169,7 +169,15 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev) > struct ltc2497core_driverdata *ddata = iio_priv(indio_dev); > int ret; > > - indio_dev->name = dev_name(dev); > + /* > + * Keep using dev_name() for the iio_dev's name on some of the parts, > + * since updating it would result in a ABI breakage. > + */ > + if (ddata->chip_info->name) > + indio_dev->name = ddata->chip_info->name; > + else > + indio_dev->name = dev_name(dev); > + > indio_dev->info = <c2497core_info; > indio_dev->modes = INDIO_DIRECT_MODE; > indio_dev->channels = ltc2497core_channel; > diff --git a/drivers/iio/adc/ltc2497.h b/drivers/iio/adc/ltc2497.h > index 95f6a5f4d4a6..fd3dfd491060 100644 > --- a/drivers/iio/adc/ltc2497.h > +++ b/drivers/iio/adc/ltc2497.h > @@ -12,6 +12,7 @@ enum ltc2497_chip_type { > > struct ltc2497_chip_info { > u32 resolution; > + const char *name; > }; > > struct ltc2497core_driverdata {