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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 DF4F3C6778D for ; Tue, 11 Sep 2018 08:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8969E20880 for ; Tue, 11 Sep 2018 08:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8969E20880 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726792AbeIKNgP (ORCPT ); Tue, 11 Sep 2018 09:36:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:53984 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726387AbeIKNgP (ORCPT ); Tue, 11 Sep 2018 09:36:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6D8F8ACD9; Tue, 11 Sep 2018 08:37:59 +0000 (UTC) Date: Tue, 11 Sep 2018 10:37:59 +0200 Message-ID: From: Takashi Iwai To: "Anders Roxell" Cc: , , Subject: Re: [PATCH] ALSA: hda: fix unused variable warning In-Reply-To: <20180911082559.24214-1-anders.roxell@linaro.org> References: <20180911082559.24214-1-anders.roxell@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/26 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Sep 2018 10:25:59 +0200, Anders Roxell wrote: > > When CONFIG_X86=n function azx_snoop doesn't use the variable chip it > only returns true. > > sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’: > sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable] > struct azx *chip = bus_to_azx(bus); > ^~~~ > > Create a inline function of azx_snoop. > > Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object") > Signed-off-by: Anders Roxell > --- > sound/pci/hda/hda_controller.h | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h > index 0053b704ddc4..aa20048742d0 100644 > --- a/sound/pci/hda/hda_controller.h > +++ b/sound/pci/hda/hda_controller.h > @@ -170,11 +170,10 @@ struct azx { > #define azx_bus(chip) (&(chip)->bus.core) > #define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core) > > -#ifdef CONFIG_X86 > -#define azx_snoop(chip) ((chip)->snoop) > -#else > -#define azx_snoop(chip) true > -#endif > +static inline bool azx_snoop(struct azx *chip) > +{ > + return IS_ENABLED(CONFIG_X86) || (chip->snoop); > +} The idea is good, but the patch is obviously wrong; it should be !IS_ENABLED() :) Also, please remove the parentheses around chip->snoop. thanks, Takashi