mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <mike.travis@hpe.com>
To: Christoph Hellwig <hch@infradead.org>, Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, Steve Wahl <steve.wahl@hpe.com>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Hedi Berriche <hedi.berriche@hpe.com>,
	Justin Ernst <justin.ernst@hpe.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Russ Anderson <russ.anderson@hpe.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/platform/uv: avoid unused variable warning
Date: Thu, 12 Dec 2019 07:16:07 -0800	[thread overview]
Message-ID: <192a2aa9-5c50-bb8d-4b0f-95eb87de48c0@hpe.com> (raw)
In-Reply-To: <20191212145432.GA15634@infradead.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)
>  {

  reply	other threads:[~2019-12-12 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 13:58 Arnd Bergmann
2019-12-12 14:01 ` Arnd Bergmann
2019-12-12 14:54 ` Christoph Hellwig
2019-12-12 15:16   ` Mike Travis [this message]
2019-12-12 14:03 Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=192a2aa9-5c50-bb8d-4b0f-95eb87de48c0@hpe.com \
    --to=mike.travis@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hch@infradead.org \
    --cc=hedi.berriche@hpe.com \
    --cc=hpa@zytor.com \
    --cc=justin.ernst@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=russ.anderson@hpe.com \
    --cc=steve.wahl@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®