Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12949427rwl; Wed, 4 Jan 2023 01:01:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJfN7rTqe7upEzhOE68n/B9p11PsO2Ui/WqBFg7NwqWqjGe36+kBAu2Zasfks+2ihtAzMR X-Received: by 2002:a17:90b:1f90:b0:219:d274:ba43 with SMTP id so16-20020a17090b1f9000b00219d274ba43mr51278505pjb.47.1672822866333; Wed, 04 Jan 2023 01:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672822866; cv=none; d=google.com; s=arc-20160816; b=Mx7Ar4PXbwToXVAq57co08iEIcjuhZU9m0Lnss7YR4DQX68xjLy+JzhXND+p2dZKv1 uSdvyXfpKJe3HcyJnya0jt47twawfjb0Gk3rY5Kicf9yIOqipINPwyoLYuZnwNwEUuV6 MTWx1AldHIUGfcSFb/z+m+JhZEGb7h4AyUt51pPh+zVvJVJsD4XyLxcA5zVmk1vJiLX5 2Sb/sM0/0ufwWEO2H7Oo+EcF5jpmXxllzzR1kPyssvi/NPWX3uM6ane7338xwEeV8Fhr MR5XSMjPRpNRo+sRPZAMk7orPvgEOOmURImCO8ww+ZP1WOEtEkDp3b9cv0P0z29loFmN SETw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ig2pSFNGdXdI/0MB8/Y507fSTt7G3AU0Ssd0OT5DZu0=; b=aInJPxNRe+dTskXVZd9NDbHNyaYMeXd/+/hTisPaGaYQqyouMRF+rk3bHCW0dPJYAd kq3125ojw8Bir5ZRV25dM7Hv2CSvL6d5RjSvODD2GQIqEO5L/1unztVbbDTCI4ouZVHd h8gudUm658snsrltGtRAWhL6Bq8r9nPcH/U43bUMJaVqJ7ixLBuyPXGpOM7g06aY/wf/ CCvOFmle4f8igUIGXMGDObwE5zGbdYo4DXbf9NL2hLup0xOswzlXusQ3eVIiqhpGGARs xUr+YnVL2cenkCZA0xmfMNBCffhGGkxS9+ZOCFATrgqFMlfpw2vVJqvGscWTo2atzJHz afVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OuC2NROc; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf7-20020a17090b1d8700b00213587b200esi33347333pjb.189.2023.01.04.01.00.59; Wed, 04 Jan 2023 01:01:06 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=OuC2NROc; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229773AbjADI25 (ORCPT + 57 others); Wed, 4 Jan 2023 03:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233916AbjADI2y (ORCPT ); Wed, 4 Jan 2023 03:28:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0244D1869B; Wed, 4 Jan 2023 00:28:54 -0800 (PST) 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 91F4F615B3; Wed, 4 Jan 2023 08:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81F1AC433EF; Wed, 4 Jan 2023 08:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672820933; bh=ar58y5os2YGCAH8RwgQby1IB5feNCexZ70wETyJ4bsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OuC2NROcRWzws+vDOMTnmXLtUpumjs6aEgJvqZVed3L4FCLNjg7iFFvdotMv/HFbS deug4P+0xscrQpTGM6RvF/g3sMX5GBp9Tn+y3yK1BpTjaUzFuwxq+PLXwb8K5G4xzE 7O3PzrwbNw9PJ2oEXLip6A0ourIhlFFdXdYjrU4Y= Date: Wed, 4 Jan 2023 09:28:50 +0100 From: Greg Kroah-Hartman To: Deepak R Varma Cc: Jiri Slaby , "Maciej W. Rozycki" , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar Subject: Re: [PATCH v4 2/2] tty: serial: dz: convert atomic_* to refcount_* APIs for irq_guard Message-ID: References: <51ef854f77779c82010379420139993e12c38776.1671898144.git.drv@mailo.com> <3c4e744f-c313-e195-af93-a22382c81bb6@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 Tue, Jan 03, 2023 at 03:39:17PM +0530, Deepak R Varma wrote: > On Tue, Jan 03, 2023 at 10:00:48AM +0100, Jiri Slaby wrote: > > On 26. 12. 22, 7:21, Deepak R Varma wrote: > > > The refcount_* APIs are designed to address known issues with the > > > atomic_t APIs for reference counting. They provide following distinct > > > advantages: > > > - protect the reference counters from overflow/underflow > > > - avoid use-after-free errors > > > - provide improved memory ordering guarantee schemes > > > - neater and safer. > > > Hence, replace the atomic_* APIs by their equivalent refcount_t > > > API functions. > > > > > > This patch proposal address the following warnings generated by > > > the atomic_as_refcounter.cocci coccinelle script > > > atomic_add_return(-1, ...) > > ... > > > --- a/drivers/tty/serial/dz.c > > > +++ b/drivers/tty/serial/dz.c > > ... > > > @@ -400,18 +399,16 @@ static int dz_startup(struct uart_port *uport) > > > struct dz_port *dport = to_dport(uport); > > > struct dz_mux *mux = dport->mux; > > > unsigned long flags; > > > - int irq_guard; > > > int ret; > > > u16 tmp; > > > > > > - irq_guard = atomic_add_return(1, &mux->irq_guard); > > > - if (irq_guard != 1) > > > + refcount_inc(&mux->irq_guard); > > > + if (refcount_read(&mux->irq_guard) != 1) > > > return 0; > > > > > > - ret = request_irq(dport->port.irq, dz_interrupt, > > > - IRQF_SHARED, "dz", mux); > > > + ret = request_irq(dport->port.irq, dz_interrupt, IRQF_SHARED, "dz", mux); > > > > How is this related to the above described change? > > No, it is not. My apologies. I must have joined the lines for improved readability > and forgot to revert. I will restore this in next revision based on the feedback > on the other patch of this series. OR I can include this change in the current > change log as a "while at it..." statement. Would you advise me? NEVER have a "while at it..." change as part of a commit unless it is relevant to the main change being made. You know better... thanks, greg k-h