From patchwork Sat Jan 28 19:19:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9543437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4DA360415 for ; Sat, 28 Jan 2017 19:27:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB31228178 for ; Sat, 28 Jan 2017 19:27:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB10B28335; Sat, 28 Jan 2017 19:27:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E4AB28178 for ; Sat, 28 Jan 2017 19:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751794AbdA1T1J (ORCPT ); Sat, 28 Jan 2017 14:27:09 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34184 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbdA1T1J (ORCPT ); Sat, 28 Jan 2017 14:27:09 -0500 Received: by mail-pg0-f65.google.com with SMTP id 3so10039499pgj.1; Sat, 28 Jan 2017 11:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=IIbAmACCKKxJrjlU8kLU4QNQvj0A9pMNZQkGHIUHZtA=; b=oKGiCc32OGWJJ3VSOtrxWMN13dgZ0w2DCroBBCjyc/kgYC4bhuKUH0Y61cymGDsw6s a/nJAypdJNz1j4u0pismSGFW7vX3daRgYgP8QjLtdCpEvvLqXSpwp3C9Wa+4OWzAAWJs gSCdj0eAtFGrGYg93iQbqBvBVdXUr/NY5upcAafSiImqDQh65k47R0KzJpCxV23wR+g5 KTW3EkptX2m/f/Qnse6xcRGXz35wXdMkkxMbHaCVfnyrOX+0zALEBLlbVGoih0XOxWfy lA/61UzIfASeLBb7tCJyQokHrSvS9tySjPMPvIjKTSlRgqVZUAiusVlGTpk800lO5Iz6 2uXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=IIbAmACCKKxJrjlU8kLU4QNQvj0A9pMNZQkGHIUHZtA=; b=ukExdpzum7cf0ro6Iex7ZjAh8/i+DtaLwSqZBAPPaFRuL5nKB314TvgX1rC3Qy8Krv nSVxpdiV5K0dvGgrX72aKUHyheCmtaRfV4+Pt6fkTOAVtooIawA8teL70w/Ey1qSWnLh c1xvbo2vncoFXHvCQgkdC5tMD39lnijamVdAsceJYqiNxBP/11Bex+sLjKajbwCAs9uj Xg0Uk5FGLGgE+S5Avpc1zlwm+0Y3661V7/a20PoQ36RzjBgoWSZgaFzlqbPAWR1iCniE At9rEecogWgnKMJweW2Itd3ojoYuTho5zYRkaS5boGfDmcAErVgaZeYe9QOC1GkIImQL zoIA== X-Gm-Message-State: AIkVDXIlM4FdSi6j40kgQvXjrl/DoAGAfHG/OOmKa+dtSoGq+NDn+PxHEtg5m9mjTV9eNA== X-Received: by 10.98.73.74 with SMTP id w71mr15497355pfa.52.1485631163138; Sat, 28 Jan 2017 11:19:23 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1311:90eb:8a67:9b0e:4ecf]) by smtp.gmail.com with ESMTPSA id y201sm20664049pfb.16.2017.01.28.11.19.20 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sat, 28 Jan 2017 11:19:20 -0800 (PST) Date: Sat, 28 Jan 2017 11:19:18 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Raphael Assenat , linux-kernel@vger.kernel.org Subject: [PATCH] Input: joydev - use clamp() macro Message-ID: <20170128191918.GA38093@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have a nice macro ensuring that the value is within certain range, let's use it instead of open-coding. Signed-off-by: Dmitry Torokhov --- drivers/input/joydev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index db5e290e897e..065e67bf56dd 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -87,7 +87,7 @@ static int joydev_correct(int value, struct js_corr *corr) return 0; } - return value < -32767 ? -32767 : (value > 32767 ? 32767 : value); + return clamp(value, -32767, 32767); } static void joydev_pass_event(struct joydev_client *client,