From patchwork Mon Jan 25 15:54:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101116 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1438525lbb; Mon, 25 Jan 2016 07:55:31 -0800 (PST) X-Received: by 10.98.18.2 with SMTP id a2mr26805590pfj.145.1453737330962; Mon, 25 Jan 2016 07:55:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si34456099pfi.110.2016.01.25.07.55.30; Mon, 25 Jan 2016 07:55:30 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933316AbcAYPz2 (ORCPT + 30 others); Mon, 25 Jan 2016 10:55:28 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:55252 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933060AbcAYPzA (ORCPT ); Mon, 25 Jan 2016 10:55:00 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MJCI6-1aPOQl25ne-002sm3; Mon, 25 Jan 2016 16:54:33 +0100 From: Arnd Bergmann To: Arnd Bergmann , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] char: nwbutton: avoid unused variable warning Date: Mon, 25 Jan 2016 16:54:25 +0100 Message-Id: <1453737270-1959897-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:VtwUnKgday5hTGJpWPRLNlv+ey3Nhj+S0T3vN9HV7TMu2X8pMOA Zh2GpQf0lyZC/oXvniKeQRg9FT0qVny94JHLbmep10np8PhBWHuF5hcZ7fHScAyaZ6l+u3+ TeqE9vFNO1/waVYW8zrM+TXhTgaIGLG3wsRFMW6R2K7V+4w0t0+8qrxFFJ8JfJp1cU+Ua3i +YMYcYCPWmLK7whGA5HsQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:J2+bg55vwb4=:dBBfHKmeAlkcW1pkyFmsRd /xuLx5eOKl3gdhqbkrAZcOWfnnTdhR7h4TpkCV2wOdBwJN6QKwpc3QQrsWSsLNXTideM2qdKm 0B6FW0UdeB9Rq01083StEQmYUpRzwRPgcrXNTSBRn1mpEA3cDzK3t06irn/MdjVBDjx8yyvy9 cpaY6R20tle8CXa4LJXYeci7K6pCWVZbbOyanRn9hkbf34Nrp+gopCeRsOpwYIavdhX6VIrKl Vdj4BFvTDFvbpTx9jc18m74v5VztTnaUMW9BqNHQ/GPzXBfyOFt1aBy4yuXZR5omDvLpNBUby PnTZ4g4MUMNZUxLFtUa4kyy+ULz7hM2GsGa5MrDuD/xGIyVqmquHuxFwhLSX80Y29fMxUPhvI aI8XTlxPpJQoeD8qX3cjOWa2AmiPCb3B0JgoQ5rr7t0amYJ8C7DfGGmRPqSZgil6BcX3N+qLW IY9+WYv2qqVmde+z1aR4RTZbbSTTQOBblrmVzxaQOZnx/EZqtXpd283Sm3NwsupEs9k0/2AIQ 9+ZgqFrGKi6cCfVn052aqEYPhmqi5GB6lDKovpo8j+wP5PcnmeEf7dM+0tmXGSLRAT1wpTnnj d0mF+0YjAPX3D0diKfZI3bMpipTslf2wG28LRs7MKV2eGcx7p6xr6QKbDakm8raeEbxmsLXl9 8ICJIwr8DCkS3vd1/AFSsO66a5u2ynHMaSDozCYSERP3WlqO/3j7Fhj4Fy19e3XkZ8qI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_NWBUTTON_REBOOT is disabled, we get a warning about an unused variable: drivers/char/nwbutton.c:37:12: warning: 'reboot_count' defined but not used [-Wunused-variable] static int reboot_count = NUM_PRESSES_REBOOT; /* Number of presses to reboot */ Using if(IS_ENABLED()) instead of #ifdef around the user makes the code nicer to read and avoids the warning. Signed-off-by: Arnd Bergmann --- drivers/char/nwbutton.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.0 diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 76c490fa0511..0e184426db98 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c @@ -129,10 +129,9 @@ static void button_consume_callbacks (int bpcount) static void button_sequence_finished (unsigned long parameters) { -#ifdef CONFIG_NWBUTTON_REBOOT /* Reboot using button is enabled */ - if (button_press_count == reboot_count) + if (IS_ENABLED(CONFIG_NWBUTTON_REBOOT) && + button_press_count == reboot_count) kill_cad_pid(SIGINT, 1); /* Ask init to reboot us */ -#endif /* CONFIG_NWBUTTON_REBOOT */ button_consume_callbacks (button_press_count); bcount = sprintf (button_output_buffer, "%d\n", button_press_count); button_press_count = 0; /* Reset the button press counter */