Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp942389ybl; Thu, 12 Dec 2019 07:18:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyP42IgWzwx/0MR4iTpQrIT2p6h+ir9LwacTBQ9LoHh9xo9XWE7XkjZFq7t184x9pfRRGDE X-Received: by 2002:a05:6830:22e6:: with SMTP id t6mr9079480otc.244.1576163925638; Thu, 12 Dec 2019 07:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576163925; cv=none; d=google.com; s=arc-20160816; b=VXo8mc+DIfVOn8Ygt6g2ONaLbY9UgU7nzYLYIFDqhhEW90Bc2S3XGt5ZEF5zPLd7xL Z0asSNxnZfWywhRc3zQXs0TFyWRG6WmnLNtNBuknDEIlthesi7/M+5vo+Mssfy4Xamog nSEVQlb3Mc2V2hC5wcVtJ9LZhAfXE28io71ygO2k0gK3lRke438q6PW0I4RzGYQ1+3pY fCu+USqnsG28PDLRQ7kI7HKXaJWb5tY7+TANeFyJVA09feJNEm09Od+RFre15Tg9v3xh k4LwF3o7DUCTYB8i5gh6+M27bxk9FhsthJBdv0kpB2IJj8lY2OjfVH1xQJAepH6IBzjx L6/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6v8HBStSygIxgGXMArAeOvTVqfoQzcA/pLvP+bRO0tc=; b=aQp2xwIDl/rFyNFsaGLgGBNj5FQaA7XaGzGkNZlRPwhLUpxcaGYBZvQ9Y4jaz7HnZj LNXFd2xszmnQYaWEC76QZkaMal0TqOKlHzJv0rHrWhp6td5RuMpTWs+dcihBU0fcnJbq hF8c9jPHwmyNQWEN4WtMEnrM+Q5G7ZOwC6SGxYZmHJX9kwCVaw+lcENQrOJl/x3fdu/G VCUAhWyG16As0dpscIGDlE7l7EIP23124JbODdRJ0uuzdt4HVBQxAAvOsJdjJ8oAGa7p jNOsp/xPbZHZY0BrUGsZCGlDlMU9kEmfJCdwF24017i/IhRZ7iyiZdf2KwJHQRJxsVAr Le4A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=hpe.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si3326204oic.72.2019.12.12.07.18.30; Thu, 12 Dec 2019 07:18:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729121AbfLLPQr (ORCPT + 99 others); Thu, 12 Dec 2019 10:16:47 -0500 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]:41218 "EHLO mx0a-002e3701.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729013AbfLLPQq (ORCPT ); Thu, 12 Dec 2019 10:16:46 -0500 Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBCF8WdN030734; Thu, 12 Dec 2019 15:16:14 GMT Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0a-002e3701.pphosted.com with ESMTP id 2wuk54adxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Dec 2019 15:16:13 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id BA22C66; Thu, 12 Dec 2019 15:16:12 +0000 (UTC) Received: from [16.116.160.152] (unknown [16.116.160.152]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id F0F604F; Thu, 12 Dec 2019 15:16:09 +0000 (UTC) Subject: Re: [PATCH] x86/platform/uv: avoid unused variable warning To: Christoph Hellwig , Arnd Bergmann Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Steve Wahl , Dimitri Sivanich , Andrew Morton , "H. Peter Anvin" , Hedi Berriche , Justin Ernst , Peter Zijlstra , Russ Anderson , Anshuman Khandual , linux-kernel@vger.kernel.org References: <20191212135815.4176658-1-arnd@arndb.de> <20191212145432.GA15634@infradead.org> From: Mike Travis Message-ID: <192a2aa9-5c50-bb8d-4b0f-95eb87de48c0@hpe.com> Date: Thu, 12 Dec 2019 07:16:07 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191212145432.GA15634@infradead.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-12_03:2019-12-12,2019-12-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912120116 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/12/2019 6:54 AM, Christoph Hellwig wrote: > Instead of that maybe_unused mess please just use good old ifdefs. > >> if (hubless) >> - proc_version_fops.open = proc_hubless_open; >> + proc_create_single("hubless", 0, pde, proc_hubless_show); >> else >> - proc_version_fops.open = proc_hubbed_open; >> + proc_create_single("hubbed", 0, pde, proc_hubbed_show); >> } > > Or someone could figure out what happens if we turn the > proc_create_single stub into an inline function instead of the > define. That makes it used at a syntactic level, the big question is > if the compiler is smart enough to optimize away the unused callback > still. > Yes, if CONFIG_PROC_FS is undefined, then this whole section can be removed since it's sole purpose is to set up the /proc/ interface. Something like this should suffice: > --- > arch/x86/kernel/apic/x2apic_uv_x.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c > +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c > @@ -1533,6 +1533,7 @@ static void check_efi_reboot(void) > reboot_type = BOOT_ACPI; > } > > +#ifdef CONFIG_PROC_FS > /* Setup user proc fs files */ > static int proc_hubbed_show(struct seq_file *file, void *data) > { > @@ -1595,6 +1596,14 @@ static __init void uv_setup_proc_files(i > proc_version_fops.open = proc_hubbed_open; > } > > +#else /* !CONFIG_PROC_FS */ > + > +static __init void uv_setup_proc_files(int hubless) > +{ > +} > + > +#endif /* !CONFIG_PROC_FS */ > + > /* Initialize UV hubless systems */ > static __init int uv_system_init_hubless(void) > {