Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1289280ybi; Sat, 27 Jul 2019 06:33:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH3KzNB4KaOhqPruneJI78eFoLf4+vP8u2BOS0pIywMxnce7EKCIVDHl4R9ogeb8tmY0v1 X-Received: by 2002:a17:90a:eb04:: with SMTP id j4mr99213524pjz.103.1564234384034; Sat, 27 Jul 2019 06:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564234384; cv=none; d=google.com; s=arc-20160816; b=lPWEaFzQrY8cWJi1VPTG190uOD0kHhkiG21NL2fV99B1ITO99bNPrMm5aGDsQmGX/w HI1RovAhZNQVuClyZlv9WFTRvLSBLUwsFBkR5g8T/kQCparhbPVOuQpa7tOvVjy2+E1O TxkJ7bTJSjJtdgPn19TcbMu1+PJgR+T2tRO1tZyacCkC/BJJcEktY1/HaEJaHQ6q/GDy 8Ke53gAgZYIapsuIrgzZklG0RarAE4npzgZwY+yc5/Vd+ZxRU/bEvTmyDsK40oCMHjT6 axRkRfOOAslPoPul+1rsPgJJ9i3HJAmpX8fXu50Q9murbJVI8iRm4+lO/lsgQwssJalb 7SMA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=noAVOMh5xoaygNcSxRqGzjDw6vQW18QKw/C673Z/Do0=; b=iswF3WI5ZcKAPQQrfc4sFVJTBw+mikdyRiV+d6EVr7/G6885O/H/MEOAuqER3S0vTV EeN51jxEzTSF+xaoDmrgKyC1qYO6aohT5Cu52uk9axQW+wlrIbROPnhOmacXMNfTogJ2 J8zAD6JAJiq8EFanrvqXsiptwK0QJvFQSXdO27Q4JjjlNbTFYNu2M8vYfQ7SGtbbC++a gJ1cziFlwOwcgOi165aeJ3Vf8cbb16idSuex96Uj7Mcv2u1jm93m7usC+jzmPyrsTRC4 Fj6lZR1xaEg+SgK5pMBpfAEJSjzXDbjVtSoPRW7T6IbgftifmCVm+iCma5hb5MajOZuS 8nkg== 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 a9si20608548plm.295.2019.07.27.06.32.46; Sat, 27 Jul 2019 06:33:04 -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 S2387616AbfG0Nbh (ORCPT + 99 others); Sat, 27 Jul 2019 09:31:37 -0400 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:42860 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387514AbfG0Nbh (ORCPT ); Sat, 27 Jul 2019 09:31:37 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 941819E6A6F; Sat, 27 Jul 2019 14:31:34 +0100 (BST) Date: Sat, 27 Jul 2019 14:31:33 +0100 From: Jonathan Cameron To: Patrick Havelange Cc: Chuhong Yuan , William Breathitt Gray , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] counter/ftm-quaddec: Use device-managed registration API Message-ID: <20190727143133.26a36f70@archlinux> In-Reply-To: References: <20190726022836.7182-1-hslester96@gmail.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Jul 2019 14:51:30 +0200 Patrick Havelange wrote: > Hello, > > On Fri, Jul 26, 2019 at 4:28 AM Chuhong Yuan wrote: > > > > Make use of devm_counter_register. > > Then we can remove redundant unregistration API > > usage to make code simpler. > > > > Signed-off-by: Chuhong Yuan > > --- > > Changes in v2: > > - Use devm_add_action_or_reset to keep > > resource release order. > > This is better now indeed. > > However it seems there is an issue with the mail/patch format, I'm > unable to apply it with git am, and if you look at > https://lore.kernel.org/patchwork/patch/1105782/ the diff section is > missing the beginning of the patch. I don't know why, but I think it > should be looked into. > > Otherwise, it's fine by me. Hi Patrick, A formal, Acked-by or Reviewed-by definitely preferred if you are happy to give one. This looks fine to me as well. William, if you are happy with the resend of this, then let me know if you want me to queue it up. Thanks, Jonathan > > Regards, > > Patrick Havelange > > > > - _remove() function is redundant now, > > delete it. > > > > drivers/counter/ftm-quaddec.c | 31 +++++++++++-------------------- > > 1 file changed, 11 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c > > index 68a9b7393457..76c70a6c3593 100644 > > --- a/drivers/counter/ftm-quaddec.c > > +++ b/drivers/counter/ftm-quaddec.c > > @@ -100,16 +100,17 @@ static void ftm_quaddec_init(struct ftm_quaddec *ftm) > > ftm_set_write_protection(ftm); > > } > > > > -static void ftm_quaddec_disable(struct ftm_quaddec *ftm) > > +static void ftm_quaddec_disable(void *ftm) > > { > > - ftm_clear_write_protection(ftm); > > - ftm_write(ftm, FTM_MODE, 0); > > - ftm_write(ftm, FTM_QDCTRL, 0); > > + struct ftm_quaddec *ftm_qua = ftm; > > > > + ftm_clear_write_protection(ftm_qua); > > + ftm_write(ftm_qua, FTM_MODE, 0); > > + ftm_write(ftm_qua, FTM_QDCTRL, 0); > > /* > > * This is enough to disable the counter. No clock has been > > * selected by writing to FTM_SC in init() > > */ > > - ftm_set_write_protection(ftm); > > + ftm_set_write_protection(ftm_qua); > > } > > > > static int ftm_quaddec_get_prescaler(struct counter_device *counter, > > @@ -316,22 +317,13 @@ static int ftm_quaddec_probe(struct platform_device *pdev) > > mutex_init(&ftm->ftm_quaddec_mutex); > > > > ftm_quaddec_init(ftm); > > - > > - ret = counter_register(&ftm->counter); > > + ret = devm_add_action_or_reset(&pdev->dev, ftm_quaddec_disable, ftm); > > if (ret) > > - ftm_quaddec_disable(ftm); > > - > > - return ret; > > -} > > - > > -static int ftm_quaddec_remove(struct platform_device *pdev) > > -{ > > - struct ftm_quaddec *ftm = platform_get_drvdata(pdev); > > - > > - counter_unregister(&ftm->counter); > > - > > - ftm_quaddec_disable(ftm); > > + return ret; > > > > + ret = devm_counter_register(&pdev->dev, &ftm->counter); > > + if (ret) > > + return ret; > > return 0; > > } > > > > @@ -346,7 +338,6 @@ static struct platform_driver ftm_quaddec_driver = { > > .of_match_table = ftm_quaddec_match, > > }, > > .probe = ftm_quaddec_probe, > > - .remove = ftm_quaddec_remove, > > }; > > > > module_platform_driver(ftm_quaddec_driver); > > -- > > 2.20.1 > >