From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AE03C4741F for ; Thu, 5 Nov 2020 08:36:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D77DB2072C for ; Thu, 5 Nov 2020 08:36:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n9Gsyc5z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729490AbgKEIgc (ORCPT ); Thu, 5 Nov 2020 03:36:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725287AbgKEIgc (ORCPT ); Thu, 5 Nov 2020 03:36:32 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB036C0613CF for ; Thu, 5 Nov 2020 00:36:30 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id n15so719706wrq.2 for ; Thu, 05 Nov 2020 00:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=fVjcjfrrmXORahZp/hVfTr8m+lXVmFllNiKKjDMWxII=; b=n9Gsyc5zxdSKZ/TXEy7Q1nx0i1xElsOyId6HnuuHMzeVeqN9iSVzatw05vGO7/5K5m ecn+0SclYkXIFCNHBHmiQPvqp3o1KfVg+9wX7/Ap9yfDp/7ZiSu4G80c0x9MX7cINAcD Z4WBcZGVgXXuQSkfrmZZmcuFCkOtVHCVT4oleIgD22cVRVECpWH7ri2rjNeYagsqKZy5 gS9edt1U92OFeICdQ4olSaflYMshl5zfYrietGxMgb3+kfGzsWNtpwZgFpUtnHBJB4sc pLwSML8QcLiVydeeQPpfwmAcQ6OPTm0W+PjsOYKGIrRfUxiXYeHdsvYTzismMOnLcRjN W7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=fVjcjfrrmXORahZp/hVfTr8m+lXVmFllNiKKjDMWxII=; b=BNv1segmunDH2hOioztvBYuUputY6Sl+eMJQahdBpttEgv/s91CxYqHdBuQpHQ955j 2N6reiM9AqzvNlZFmbBSyadAXyRweBfkgmHsfk7MzdrElqbxhElpZbcWfvzlc0ltFwpx 7YF2f7G2NAUDcHaALSOrmrAMfRYhTaQv0WRX7sLbJC498E3/GK0PYeM6vzTPCkNlJOi5 MWpbLFr/bY4y0NamqkZeF5ECcv1FjyFONfvj8lXjVZPnItupMjD1srcfjc6SWSVvYkNW ChhWykPv7u4/EG9XlaXqIeb6/qzyiItS0Xcg2w9H1aYVZ3RaJflhzGNGXJdiwDFofXaM TSWA== X-Gm-Message-State: AOAM531tOZlj+HGkZ5NFFNYSQI08whuamLqjFGG8aVdB1+V7Jj4bFenV b5J9jTWUY1Rp9MvZWFlx7tDlbw== X-Google-Smtp-Source: ABdhPJywWSiq38BqbSd7YukFXshDJiCN4Em7tr9zBcurHrSuOGtYsiYwTQM9YCvQ5PvPaKd8VwAPwA== X-Received: by 2002:a5d:55c8:: with SMTP id i8mr1461048wrw.194.1604565389496; Thu, 05 Nov 2020 00:36:29 -0800 (PST) Received: from dell ([91.110.221.242]) by smtp.gmail.com with ESMTPSA id u16sm1337124wrn.55.2020.11.05.00.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 00:36:28 -0800 (PST) Date: Thu, 5 Nov 2020 08:36:26 +0000 From: Lee Jones To: Jiri Slaby Cc: Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Paul Mackerras , linux-serial@vger.kernel.org Subject: Re: [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused Message-ID: <20201105083626.GW4488@dell> References: <20201104193549.4026187-1-lee.jones@linaro.org> <20201104193549.4026187-35-lee.jones@linaro.org> <445a6440-b4c8-4536-891b-0cefc78e5f57@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 05 Nov 2020, Jiri Slaby wrote: > On 05. 11. 20, 8:04, Christophe Leroy wrote: > > > > > > Le 04/11/2020 à 20:35, Lee Jones a écrit : > > > Fixes the following W=1 kernel build warning(s): > > > > > >   drivers/tty/serial/pmac_zilog.h:365:58: warning: variable > > > ‘garbage’ set but not used [-Wunused-but-set-variable] > > > > Explain how you are fixing this warning. > > > > Setting  __always_unused is usually not the good solution for fixing > > this warning, but here I guess this is likely the good solution. But it > > should be explained why. There are normally 3 ways to fix this warning; - Start using/checking the variable/result - Remove the variable - Mark it as __{always,maybe}_unused The later just tells the compiler that not checking the resultant value is intentional. There are some functions (as Jiri mentions below) which are marked as '__must_check' which *require* a dummy (garbage) variable to be used. > Or, why is the "garbage =" needed in the first place? read_zsdata is not > defined with __warn_unused_result__. I used '__always_used' here for fear of breaking something. However, if it's safe to remove it, then all the better. > And even if it was, would (void)!read_zsdata(port) fix it? That's hideous. :D *Much* better to just use '__always_used' in that use-case. > > > Cc: Greg Kroah-Hartman > > > Cc: Jiri Slaby > > > Cc: Michael Ellerman > > > Cc: Benjamin Herrenschmidt > > > Cc: Paul Mackerras > > > Cc: linux-serial@vger.kernel.org > > > Cc: linuxppc-dev@lists.ozlabs.org > > > Signed-off-by: Lee Jones > > > --- > > >   drivers/tty/serial/pmac_zilog.h | 2 +- > > >   1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/pmac_zilog.h > > > b/drivers/tty/serial/pmac_zilog.h > > > index bb874e76810e0..968aec7c1cf82 100644 > > > --- a/drivers/tty/serial/pmac_zilog.h > > > +++ b/drivers/tty/serial/pmac_zilog.h > > > @@ -362,7 +362,7 @@ static inline void zssync(struct uart_pmac_port > > > *port) > > >   /* Misc macros */ > > >   #define ZS_CLEARERR(port)    (write_zsreg(port, 0, ERR_RES)) > > > -#define ZS_CLEARFIFO(port)   do { volatile unsigned char garbage; \ > > > +#define ZS_CLEARFIFO(port)   do { volatile unsigned char > > > __always_unused garbage; \ > > >                        garbage = read_zsdata(port); \ > > >                        garbage = read_zsdata(port); \ > > >                        garbage = read_zsdata(port); \ > > > > > thanks, -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E192DC00A89 for ; Thu, 5 Nov 2020 08:38:19 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E27BB2080D for ; Thu, 5 Nov 2020 08:38:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n9Gsyc5z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E27BB2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CRcNm0s4CzDqtW for ; Thu, 5 Nov 2020 19:38:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linaro.org (client-ip=2a00:1450:4864:20::443; helo=mail-wr1-x443.google.com; envelope-from=lee.jones@linaro.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=n9Gsyc5z; dkim-atps=neutral Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CRcLz4QNHzDqVr for ; Thu, 5 Nov 2020 19:36:37 +1100 (AEDT) Received: by mail-wr1-x443.google.com with SMTP id p1so689017wrf.12 for ; Thu, 05 Nov 2020 00:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=fVjcjfrrmXORahZp/hVfTr8m+lXVmFllNiKKjDMWxII=; b=n9Gsyc5zxdSKZ/TXEy7Q1nx0i1xElsOyId6HnuuHMzeVeqN9iSVzatw05vGO7/5K5m ecn+0SclYkXIFCNHBHmiQPvqp3o1KfVg+9wX7/Ap9yfDp/7ZiSu4G80c0x9MX7cINAcD Z4WBcZGVgXXuQSkfrmZZmcuFCkOtVHCVT4oleIgD22cVRVECpWH7ri2rjNeYagsqKZy5 gS9edt1U92OFeICdQ4olSaflYMshl5zfYrietGxMgb3+kfGzsWNtpwZgFpUtnHBJB4sc pLwSML8QcLiVydeeQPpfwmAcQ6OPTm0W+PjsOYKGIrRfUxiXYeHdsvYTzismMOnLcRjN W7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=fVjcjfrrmXORahZp/hVfTr8m+lXVmFllNiKKjDMWxII=; b=lI+YVLDgFOFXSLbOwsylpWqtZYtPkdb/M172awJ2/kwimvdqzDySjVEsHHTdEz3wzh bfCRkS+hRkaUrCkxaXeTw6M17huNxfju7t+HQqzdCfoSbWMENxEJRM1zLmPeY2ZGdoXP FbXDDgf2j4atlsy27H6SXdD58pGp00g1froQy2Crq1Buu74PUbXc3FSxSW/zv80qnsxa ItilBt1P9VdLhclDFVyHCDaAD61dwJcpAX554jPOVhaNNiDGKP7qq9pAhe7pzztBi0kR NdHhXtCUPIaxdR3WUDD1PBRuDbKsSXvJnyWUfK+OmgEoYKxBezLQ0dLUvfeM26Jfu9oc JhxQ== X-Gm-Message-State: AOAM532KEHeyQKMC4sGjxB5OmPhy7ywChnwrrw7RcOwR9rcDMpQoUODn IL9dbez/h8q3wYkHNCYzR/cP7w== X-Google-Smtp-Source: ABdhPJywWSiq38BqbSd7YukFXshDJiCN4Em7tr9zBcurHrSuOGtYsiYwTQM9YCvQ5PvPaKd8VwAPwA== X-Received: by 2002:a5d:55c8:: with SMTP id i8mr1461048wrw.194.1604565389496; Thu, 05 Nov 2020 00:36:29 -0800 (PST) Received: from dell ([91.110.221.242]) by smtp.gmail.com with ESMTPSA id u16sm1337124wrn.55.2020.11.05.00.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 00:36:28 -0800 (PST) Date: Thu, 5 Nov 2020 08:36:26 +0000 From: Lee Jones To: Jiri Slaby Subject: Re: [PATCH 34/36] tty: serial: pmac_zilog: Make disposable variable __always_unused Message-ID: <20201105083626.GW4488@dell> References: <20201104193549.4026187-1-lee.jones@linaro.org> <20201104193549.4026187-35-lee.jones@linaro.org> <445a6440-b4c8-4536-891b-0cefc78e5f57@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Paul Mackerras , linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, 05 Nov 2020, Jiri Slaby wrote: > On 05. 11. 20, 8:04, Christophe Leroy wrote: > > > > > > Le 04/11/2020 à 20:35, Lee Jones a écrit : > > > Fixes the following W=1 kernel build warning(s): > > > > > >   drivers/tty/serial/pmac_zilog.h:365:58: warning: variable > > > ‘garbage’ set but not used [-Wunused-but-set-variable] > > > > Explain how you are fixing this warning. > > > > Setting  __always_unused is usually not the good solution for fixing > > this warning, but here I guess this is likely the good solution. But it > > should be explained why. There are normally 3 ways to fix this warning; - Start using/checking the variable/result - Remove the variable - Mark it as __{always,maybe}_unused The later just tells the compiler that not checking the resultant value is intentional. There are some functions (as Jiri mentions below) which are marked as '__must_check' which *require* a dummy (garbage) variable to be used. > Or, why is the "garbage =" needed in the first place? read_zsdata is not > defined with __warn_unused_result__. I used '__always_used' here for fear of breaking something. However, if it's safe to remove it, then all the better. > And even if it was, would (void)!read_zsdata(port) fix it? That's hideous. :D *Much* better to just use '__always_used' in that use-case. > > > Cc: Greg Kroah-Hartman > > > Cc: Jiri Slaby > > > Cc: Michael Ellerman > > > Cc: Benjamin Herrenschmidt > > > Cc: Paul Mackerras > > > Cc: linux-serial@vger.kernel.org > > > Cc: linuxppc-dev@lists.ozlabs.org > > > Signed-off-by: Lee Jones > > > --- > > >   drivers/tty/serial/pmac_zilog.h | 2 +- > > >   1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/pmac_zilog.h > > > b/drivers/tty/serial/pmac_zilog.h > > > index bb874e76810e0..968aec7c1cf82 100644 > > > --- a/drivers/tty/serial/pmac_zilog.h > > > +++ b/drivers/tty/serial/pmac_zilog.h > > > @@ -362,7 +362,7 @@ static inline void zssync(struct uart_pmac_port > > > *port) > > >   /* Misc macros */ > > >   #define ZS_CLEARERR(port)    (write_zsreg(port, 0, ERR_RES)) > > > -#define ZS_CLEARFIFO(port)   do { volatile unsigned char garbage; \ > > > +#define ZS_CLEARFIFO(port)   do { volatile unsigned char > > > __always_unused garbage; \ > > >                        garbage = read_zsdata(port); \ > > >                        garbage = read_zsdata(port); \ > > >                        garbage = read_zsdata(port); \ > > > > > thanks, -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog