Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3252417rdg; Tue, 17 Oct 2023 08:53:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1jH8MbcRMDK29R/UH3//z1gSYbj4kCqvCv0GBzmOJFfRQjPU1Nvb4pVRtICXR7PcSOQMP X-Received: by 2002:a05:6359:b83:b0:139:d5b9:87d3 with SMTP id gf3-20020a0563590b8300b00139d5b987d3mr2893604rwb.5.1697557995697; Tue, 17 Oct 2023 08:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697557995; cv=none; d=google.com; s=arc-20160816; b=yNwKC9pDxhkRdNoTUI42uhZnK9EhSz78IlNjoECt0GOwp9HsGKCJNgDd3wWt6/LRS2 /O0oL5SqwLdPf4yU3A6D7jVwrdZeMEPzGRqprcFYGvOOenlxdlvBJdZsvi5Nhph6H6Ag RwMG/hN+phv6rBGVG4Eerm26TlEIZiQzynbqkV0TpivJkgJpajzmX5Sbj+XR/9USE2FS ivikHkfIbmz5Sbo67DtjrJA/aP1xw4xcgAzQ7AzPSwasmYszPErVsAnLYqcz2RogOByd 0TCBHRxwzf4tnMD4SYtFz3at75oE/zvMO4eQFVBWghDpwwHfb1a0HFZTcP1PiQZ/PIRL jfDw== 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=TwXK3imrlZWR4EJWunNWdrGKz4OzMytYL6ieZdwqmKY=; fh=yvlHoNQRgvK9tLX1ybBiUk3tDPxlVDri/iqW8Rk5z1o=; b=pGJOBHAQtaBnLJQwvf+SE52hj/epYPmz1EgZdNfkDsnjEUBdX+tH8LHv5r/1isXHzn IoOXHcTidQcs60XU0QPeiDr8FeHEnf2w2nLjE5Av79iiaSCJdw95WkNxc4RputbBYAF7 tiScUomKJQNxNLPRpJ0OyUZJihfSYgyAlH59ejsTyV7APivH+oHGVGWW9E4hURxUJot/ C++hVOeMUd8DrQQc3KL4rTWGxbYQ1FPjvJI0H0eGwAEmEvaT+0pKM7ACcNDgMHlzl0MJ 3ggnYJ6/MfH+nz0Q5QXjgCi5ME/d2RMLerHHDEq+xGqHri1Z0c8ywvM0NseYK0/BGx0/ 99xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O0X0OfUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k4-20020a056a00134400b00690fe11c9dbsi2003622pfu.97.2023.10.17.08.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 08:53:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O0X0OfUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DFCB980B79DF; Tue, 17 Oct 2023 08:53:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344158AbjJQPxD (ORCPT + 99 others); Tue, 17 Oct 2023 11:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235003AbjJQPxB (ORCPT ); Tue, 17 Oct 2023 11:53:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401109E; Tue, 17 Oct 2023 08:53:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51BB6C433C8; Tue, 17 Oct 2023 15:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697557979; bh=OuFCZ+mYBxI9aVlshoc+ddPbEgGI46T/EB1CuvYd5qI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O0X0OfUBXEveGf+R6NCA1uaCZYBR5VaujRjI25ewIyjGS2C36IiAzeE/vClaOcb44 T5oQTLhp8UsMpVhDI2axpM+vxATQO3m6woP7QzHBmFcYr912env/r7qbJ+yYaMfuDL usfx9uuaVlpHGxYmCfrNT2VK4Fo1aA52tWE0mTbd5Ycj3eFsvLrOsC7XkeXpZ3Nnk6 s4i89Aygtx6Tj/2allA08CpvR71vE28Uo12PVRt51LQDPKWNVj1HDIbQS6Gkmu4PCH tWgaruXeG6ofkNOHgegijWhyawiI7R2bhIFZx2FUNJ2FR1frrISZt43q+OKKsZSqAJ 5x1U95qw7bhQw== Date: Tue, 17 Oct 2023 08:52:57 -0700 From: Nathan Chancellor To: Sergio Paracuellos Cc: linux-clk@vger.kernel.org, tsbogend@alpha.franken.de, sboyd@kernel.org, mturquette@baylibre.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, arnd@kernel.org, yangshiji66@outlook.com, kernel test robot Subject: Re: [PATCH v2] clk: ralink: mtmips: quiet unused variable warning Message-ID: <20231017155257.GA710773@dev-arch.thelio-3990X> References: <20230827023932.501102-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230827023932.501102-1-sergio.paracuellos@gmail.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 17 Oct 2023 08:53:12 -0700 (PDT) On Sun, Aug 27, 2023 at 04:39:32AM +0200, Sergio Paracuellos wrote: > When CONFIG_OF is disabled then the matching table is not referenced and > the following warning appears: > > drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable] > 821 | static const struct of_device_id mtmips_of_match[] = { > | ^ > > There are two match tables in the driver: one for the clock driver and the > other for the reset driver. The only difference between them is that the > clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. > Both just can be merged into a single one just by adding the compatible > 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to > be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for > 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset'). > > Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the > above warning disapears. > > Fixes: 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs") > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202307242310.CdOnd2py-lkp@intel.com/ > Suggested-by: Arnd Bergmann > Signed-off-by: Sergio Paracuellos Reviewed-by: Nathan Chancellor > --- > Changes in v2: > - Merge two match tables into one to properly avoid this warning. > > PATCH in v1: https://lore.kernel.org/lkml/20230802092647.3000666-1-sergio.paracuellos@gmail.com/T/ > > drivers/clk/ralink/clk-mtmips.c | 20 +++++--------------- > 1 file changed, 5 insertions(+), 15 deletions(-) > > diff --git a/drivers/clk/ralink/clk-mtmips.c b/drivers/clk/ralink/clk-mtmips.c > index 1e7991439527..50a443bf79ec 100644 > --- a/drivers/clk/ralink/clk-mtmips.c > +++ b/drivers/clk/ralink/clk-mtmips.c > @@ -821,6 +821,10 @@ static const struct mtmips_clk_data mt76x8_clk_data = { > }; > > static const struct of_device_id mtmips_of_match[] = { > + { > + .compatible = "ralink,rt2880-reset", > + .data = NULL, > + }, > { > .compatible = "ralink,rt2880-sysc", > .data = &rt2880_clk_data, > @@ -1088,25 +1092,11 @@ static int mtmips_clk_probe(struct platform_device *pdev) > return 0; > } > > -static const struct of_device_id mtmips_clk_of_match[] = { > - { .compatible = "ralink,rt2880-reset" }, > - { .compatible = "ralink,rt2880-sysc" }, > - { .compatible = "ralink,rt3050-sysc" }, > - { .compatible = "ralink,rt3052-sysc" }, > - { .compatible = "ralink,rt3352-sysc" }, > - { .compatible = "ralink,rt3883-sysc" }, > - { .compatible = "ralink,rt5350-sysc" }, > - { .compatible = "ralink,mt7620-sysc" }, > - { .compatible = "ralink,mt7628-sysc" }, > - { .compatible = "ralink,mt7688-sysc" }, > - {} > -}; > - > static struct platform_driver mtmips_clk_driver = { > .probe = mtmips_clk_probe, > .driver = { > .name = "mtmips-clk", > - .of_match_table = mtmips_clk_of_match, > + .of_match_table = mtmips_of_match, > }, > }; > > -- > 2.25.1 >