Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp356330pxb; Fri, 3 Sep 2021 03:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzevPrsks234ritZOZX/iRBB5l0xLNpw1fXvjY8ddzHRF7Cm3TmTLZM96+WNInytVk7I+YA X-Received: by 2002:a17:907:212e:: with SMTP id qo14mr3545343ejb.501.1630666193277; Fri, 03 Sep 2021 03:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630666193; cv=none; d=google.com; s=arc-20160816; b=GMY/a7gfAcKIUYDhqbFHHd2Sc5Rn3y1GjJtqv0PcTxnr5Snmt83FFvfsBx+dcqxPxh uZVfOfB+ax2B38z+RUg8CB9zKUyMYAFoAqYB7M28/0QHUsHzeQJxC5OdMMN++wrVfnM+ 913SRsb5LD67+sLFJEHJ8Cmr+S7G+jQtjXiqDtqdLIGsNfnlKtlrLkddvdx+HDJoQqgw 75xcHZQlsm9eciVXOWQq6qsuoF6eMp72hbb+JuAZELWhtRTwar5OZLeFEFXV4ZvNd4Kp CVyz8zsBDn+O3GMf7LTBR+YuatpcoCn98UylI1Lhd/sttfDNTkT1T1jyLpF0EjpTbpgJ e7aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=InxKCwkaY+BSOwQRBiaO8xW0lNamfxvr6pOVA9nU0nQ=; b=iD5nWXZzxfJf6/nhYp12lmvp5sMf7R0G0ttJ97fTwqZtOTcon/6lV2VAGSGQ3IQ878 vDLo43MWUvQ4K7LgWL+dmn81dn5A9Pd3Yw9XFb3v11s9j4Ryw1VNsh3FPELWqNtj2zc3 vtjEuLoTYqFRAM5m1FTJD2CAPtbuR9iwtzCK2pL/Y9izSQ4hyT05cZgzPGKaDC8IlFZM nEd9x3rrO8jdUWtLZYJgKfEaIvoA+FS2Le+cRhr2EJaqKEu0lpl9OXgcKZv9iggqEjye 6Yzgp6Ka0j55YXHjDuqIlpCeS4l+Wn0xcySXPn037qghqq5hNzMlQFrpRMqAl5qOPfqO o5ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QkyXCzTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si5170856edi.38.2021.09.03.03.49.25; Fri, 03 Sep 2021 03:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QkyXCzTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348086AbhICIBQ (ORCPT + 99 others); Fri, 3 Sep 2021 04:01:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31768 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347597AbhICIBI (ORCPT ); Fri, 3 Sep 2021 04:01:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630656007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=InxKCwkaY+BSOwQRBiaO8xW0lNamfxvr6pOVA9nU0nQ=; b=QkyXCzTOlf3km0KSamF3vOkrQBloePaJmiH5hGsXDghVNG3CLjY0NXYuG7A7okxsxut9E4 jWLe4oJYWVjDvg9cLoRQlmTjZ0zdsiBcLQi+QaStkwS7GwWEG7rrf3XKPrQyS6r9VmUYKK +bRez9rIJH+C3XJ61Jd2v8xLO/5d1fo= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-07I_3ZQTMea7N3hR2Sn81w-1; Fri, 03 Sep 2021 04:00:06 -0400 X-MC-Unique: 07I_3ZQTMea7N3hR2Sn81w-1 Received: by mail-ej1-f70.google.com with SMTP id ne21-20020a1709077b95b029057eb61c6fdfso2308710ejc.22 for ; Fri, 03 Sep 2021 01:00:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=InxKCwkaY+BSOwQRBiaO8xW0lNamfxvr6pOVA9nU0nQ=; b=uPnKZZ2QkPXsmLtB4269KJ7pZPALaiRps8BKVOlr8s3AzabpoEZ+oTZQUo9UuS5amn hRN1R7XBQ9QS3vC1bnjZLqfbO2YVSBHFXGS5cxNb//oFbmtQgIkiSRiwGp1RQu8vV5pZ IBKuZA749HGAoddQvG4cdp315xB5j6yjTeiR/mf04Coha+DU8q/PJBW0SsSCrD/AFytg Nf5mZRPXlgrNS/FzMB+fiFfTsoI8JoRhlVzkeDg3yfFL8tB8d2eUGsfKRJng8oL8kxEx k/6F3vMIE+VeqzQGE0j0jMu/a2r9zpYrIuSlw6/c9Rw2heKbQsvEepOmxexPEpiR+UXf mJ6g== X-Gm-Message-State: AOAM532MzF4dFQvNEnkfe1LhwuJh8Npkdpepk9a21XWTY85MC4JItwia DgRP4PvdR9+SUhuMxw3eVunZ+tjkpb+oFVWxsGgCsXLTS5cZ+vDotWMjYYsPIQgEujuzkpai6bY RX1NEwOcJ//ERwkeaO0HgpIf+ X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr2884989eju.254.1630656005575; Fri, 03 Sep 2021 01:00:05 -0700 (PDT) X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr2884963eju.254.1630656005317; Fri, 03 Sep 2021 01:00:05 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id r16sm2554300edt.15.2021.09.03.01.00.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Sep 2021 01:00:04 -0700 (PDT) Subject: Re: [PATCH 3/5] iio: adc: axp288_adc: convert probe to full device-managed To: Alexandru Ardelean , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: jic23@kernel.org, wens@csie.org, andriy.shevchenko@linux.intel.com References: <20210903072917.45769-1-aardelean@deviqon.com> <20210903072917.45769-4-aardelean@deviqon.com> From: Hans de Goede Message-ID: <1e26dd27-475c-7815-9a9d-240546fa9088@redhat.com> Date: Fri, 3 Sep 2021 10:00:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210903072917.45769-4-aardelean@deviqon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 9/3/21 9:29 AM, Alexandru Ardelean wrote: > This change converts the probe of this driver to use device-managed > functions only, which means that the remove hook can be removed. > The remove hook has only 2 calls to iio_device_unregister() and > iio_map_array_unregister(). Both these can now be done via devm register > functions, now that there's also a devm_iio_map_array_register() function. > > The platform_set_drvdata() can also be removed now. > > This change also removes the error print for when the iio_device_register() > call fails. This isn't required now. > > Signed-off-by: Alexandru Ardelean Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > drivers/iio/adc/axp288_adc.c | 28 ++++------------------------ > 1 file changed, 4 insertions(+), 24 deletions(-) > > diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c > index 5f5e8b39e4d2..a4b8be5b8f88 100644 > --- a/drivers/iio/adc/axp288_adc.c > +++ b/drivers/iio/adc/axp288_adc.c > @@ -259,7 +259,7 @@ static int axp288_adc_probe(struct platform_device *pdev) > info->irq = platform_get_irq(pdev, 0); > if (info->irq < 0) > return info->irq; > - platform_set_drvdata(pdev, indio_dev); > + > info->regmap = axp20x->regmap; > /* > * Set ADC to enabled state at all time, including system suspend. > @@ -276,31 +276,12 @@ static int axp288_adc_probe(struct platform_device *pdev) > indio_dev->num_channels = ARRAY_SIZE(axp288_adc_channels); > indio_dev->info = &axp288_adc_iio_info; > indio_dev->modes = INDIO_DIRECT_MODE; > - ret = iio_map_array_register(indio_dev, axp288_adc_default_maps); > + > + ret = devm_iio_map_array_register(&pdev->dev, indio_dev, axp288_adc_default_maps); > if (ret < 0) > return ret; > > - ret = iio_device_register(indio_dev); > - if (ret < 0) { > - dev_err(&pdev->dev, "unable to register iio device\n"); > - goto err_array_unregister; > - } > - return 0; > - > -err_array_unregister: > - iio_map_array_unregister(indio_dev); > - > - return ret; > -} > - > -static int axp288_adc_remove(struct platform_device *pdev) > -{ > - struct iio_dev *indio_dev = platform_get_drvdata(pdev); > - > - iio_device_unregister(indio_dev); > - iio_map_array_unregister(indio_dev); > - > - return 0; > + return devm_iio_device_register(&pdev->dev, indio_dev); > } > > static const struct platform_device_id axp288_adc_id_table[] = { > @@ -310,7 +291,6 @@ static const struct platform_device_id axp288_adc_id_table[] = { > > static struct platform_driver axp288_adc_driver = { > .probe = axp288_adc_probe, > - .remove = axp288_adc_remove, > .id_table = axp288_adc_id_table, > .driver = { > .name = "axp288_adc", >