Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp664305imb; Fri, 1 Mar 2019 10:33:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzlB2Xs/SLjqau3FpbD5LpfVCrkH4GvcVXuUUDSNJr5eX/qCJ8CEuMmgDlJKD1De6otiJ2I X-Received: by 2002:a62:4299:: with SMTP id h25mr6883899pfd.165.1551465202468; Fri, 01 Mar 2019 10:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551465202; cv=none; d=google.com; s=arc-20160816; b=awN1MPXZl9NseIhac8f6uL8B8DeOKoK4kH8Ct4Nwv/jCip4VICflaomCj9u73Zm8uS xlzgcYNjYEMzkZHN0RyzOtD3mW2eMQDapB0TkqDeqYjca3Di9JW25m6ABjDoJ4dqdH61 UwP+GqhYn2aqrRq/DmRtczNPtPylK2LvvUPEQM2wEMY5CzM8IcBox7Ul5OR5m2LMh8N9 CKHjakLWWI65jq/rSzH2oaW9S97SAl8sY2jW2qJcQCFeNIdRn0oo3sE4SsHxKw5Vhag5 sOTs4f+x38jB+NXGAnCe+FWbEStzJstNiN5j2O8ZR5WwNKENJ+V15rzAXyHof7wocQOJ ngZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=djHAYEgW5Z35X6o6/JmdamoYrWVf1XxIzsMXRq9O6fw=; b=wZ1TdHNAhmp28ME83Q0FdAeyKHzcqIgNffuB6Q7Ln493a20STOGSkJ+MezkQ13w2cQ bAzlMNQwHn96j9osA7AxPoy4LNfUNGMPSZweoiE9PQ6qzhK470yU2DQezLnPWLUSIVl7 NNybcGYj6i5dwnqlnUeM8AWEjEXg++dESD5Qk1vIlI5S1+9sDTyaJoQsgSI8WFHZeg3s hWlCntpSHrG1uoAI9aoLxt2viH7Q0K+QnDvb1kotSLjmyIvU5y3q6Bk4PbPJsFs4yt4o kLjldbjEjELUQztRggC/Yo91LVo+wOmkMQw8LPmnOpdKpINgly1he6hIo7AwHXnzR9MX ehMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Xk3kkXqJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si23193954pfc.261.2019.03.01.10.33.07; Fri, 01 Mar 2019 10:33:22 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=Xk3kkXqJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388979AbfCAS2r (ORCPT + 99 others); Fri, 1 Mar 2019 13:28:47 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36892 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388202AbfCAS2r (ORCPT ); Fri, 1 Mar 2019 13:28:47 -0500 Received: by mail-pf1-f193.google.com with SMTP id s22so11803373pfh.4 for ; Fri, 01 Mar 2019 10:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=djHAYEgW5Z35X6o6/JmdamoYrWVf1XxIzsMXRq9O6fw=; b=Xk3kkXqJGtDR/UPyjGmFdvCIJt0UZR3JSSHjgx/IEPp6gJoSwO2KTLxpb5aYbTk0rA VHY/B6jeX8wTYNco7xoP7WQgygAFzFY/3YPzdwCgRfTbTKMiP6WvViFubY2efUG/MliQ Noj54c2aLR2766RG9djZNrIV5x1ALEeCu6T/P5sEyHMz46SVahi+TbaxsYvAZ9vmkSYd 6WbnK/VaxRrSH4MBXBZJ2RA246404dQ+jq4PnHKq92uiXPrI8P6qEDTQaW7hlxDpKCV3 PhlCT8q95BhGm6zTpYK+MsPFfCBjz0u+mQ/fmyOZ8nqBvpHL5YAYiZXjiKqQwSWrbc42 V3xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=djHAYEgW5Z35X6o6/JmdamoYrWVf1XxIzsMXRq9O6fw=; b=Mufa/ElW+7Es6WLYflBFvduVAq6vEXQjiHrN5j9Mr3fhklK+18G12Ut8nFUyjTXTUW urn1bpV3EkbvLePKJ8g/EDcZwpBWKW8Ip+gfB4GlUuzF0kSuYuEgMf1aHZ+rvJw6Dmcu JHYt+lLN4JbNBken6Dg8Ara9RhiRDKPRU9Zkrv7/zk9f/7myHZKPOLR392/0ZlQY/GIi UZp9vFzTi8Kv77C9+cvUZvfCVDDzvw90eofjRnYSeuFWFn03i2FZXPA1BuqzGD1uesYA I6+M0fkq199/o5gnWxQjKxuaeQ1QBWcX49iiXT+h77if0gePMiwO09gNsu7Oknpge8p9 qtbg== X-Gm-Message-State: APjAAAUP0kDSfqhCwCxC4eRr0EXPkJr3/jB9Gd1+4CK8cJVIDtpABYY6 x8ygF9AQGsXwKFT9wcvNMTENu20LlD4r8Zl7lRfKJQ== X-Received: by 2002:a63:c70c:: with SMTP id n12mr6249416pgg.302.1551464926158; Fri, 01 Mar 2019 10:28:46 -0800 (PST) MIME-Version: 1.0 References: <20190208050921.GA8758@archlinux-ryzen> <20190208143403.GD7035@unicorn.suse.cz> In-Reply-To: <20190208143403.GD7035@unicorn.suse.cz> From: Nick Desaulniers Date: Fri, 1 Mar 2019 10:28:35 -0800 Message-ID: Subject: Re: Clang warning in drivers/net/ethernet/intel/igc/igc_ethtool.c To: Michal Kubecek Cc: netdev@vger.kernel.org, Nathan Chancellor , Sasha Neftin , Jeff Kirsher , Aaron Brown , intel-wired-lan@lists.osuosl.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 8, 2019 at 6:34 AM Michal Kubecek wrote: > > On Thu, Feb 07, 2019 at 10:09:21PM -0700, Nathan Chancellor wrote: > > Hi all, > > > > After commit 8c5ad0dae93c ("igc: Add ethtool support"), Clang warns: > > > > drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: warning: variable 'igc_priv_flags_strings' is not needed and will not be emitted [-Wunneeded-internal-declaration] > > static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = { > > ^ > > 1 warning generated. > > > > igc_priv_flags_strings is only used in an ARRAY_SIZE macro, which is a > > compile time evaluation, so no reference to it is being emitted in the > > final assembly. Is it actually needed and was forgotten to be used > > somewhere or could it be eliminated so that Clang no longer warns? > > That's because the driver provides get_priv_flags() and set_priv_flags() > callbacks in its ethtool_ops to allow querying and setting legacy-rx > private flag but it does not provide get_sset_count() and get_strings() > to provide list of private flags to userspace ethtool. So the variable declaration should get a `__unused` annotation then (and maybe a comment)? -- Thanks, ~Nick Desaulniers