From patchwork Thu Sep 5 04:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13791705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95519CD4F50 for ; Thu, 5 Sep 2024 04:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=K4M9q+kN73VYSDW6L8zxKtLlMvaCoXBGrFd+VEAeAfA=; b=SbPD1ZP2MbpsOhVZLJrzBJ9Jrt BQiMd3Y8fJGLLXgqwco55rFoTz8bt+mb1jAQUxRXIA7uE2M1hWyZ0d3rDMI8Gy05xK6LGT/ky5sgb MrR3WFihXwSMnrVBOwfQR3IxQSO1bfs+7s9ec6p1bJJ8Usf84v+XZmRBvcFlYHt8t9UHe9Si+hhBn FvFlF3o+nfZhpJs6sf6s3Mi0vf5Pcc7FvzZjDdwEytJBB2kqtMtcE1Xy8vTryikcNR2TSDFU5Cxmt xdPMV8g/Trdd5Xc2vLX46jNIocM92G+solUJ7dsGp1URuwoKjUkvagff7nmIebFzD9Qu94DO6vEy8 i6HefXxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3xG-00000006tgB-1D2H; Thu, 05 Sep 2024 04:18:46 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3wF-00000006tK2-48hZ for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 04:17:45 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5df9a9f7fe2so235755eaf.2 for ; Wed, 04 Sep 2024 21:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725509863; x=1726114663; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=K4M9q+kN73VYSDW6L8zxKtLlMvaCoXBGrFd+VEAeAfA=; b=dvEOun3rjPd6wSuHDr3aVyQcOSJtNIhckI11+tqwBdGsIbiqM1FejgziHZYvW6u333 lWwwJpX9ajUFkqBk0xR4+RMw0iVTMrkwlqyedWRB0aCIkxoYwN4I2cnOcMW9MvhOhzs+ VSiUKt9tv+phyc9zl+j16jgkX3sjV0SdLNqj1Q7WRsqXQW+na4ybSvskIb34HXq2J4VO 4qD4lfLHtC3F2ySvXKUqfte1UnYPNnH2N2xWmYEblGgywF3IKdF2w/oVzk6ogxOmWPCo /4vov4ZuGZgJvM9+pNcpytIOOmuCSKbmmIJP+PBWSfs/mGZhtZF978OEBGlt+goHOMSZ I5DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725509863; x=1726114663; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K4M9q+kN73VYSDW6L8zxKtLlMvaCoXBGrFd+VEAeAfA=; b=qMIyPG5ThIXYcCy7+ZuvLGZkMyvA/EW15625ZbS9pkH+Dt33YlaY/fHkPCplnI45Pu E9/3A4QpQ1HsVfOlotZAxbjLdBft6xVhYJxyJ6YL+bAeO2H5h/qKzMqFh5YoQlyM6OM5 W/8chuMkukOI0Ng3HKLOVDif2qODCMFK+wHSLED51bq19vp68XjUHcPXqhEsTOe/koTI qwLWGLE/UlJ2v1+4mNsV8FsRC1PPSpcRf53k1FnsxJJcxHnd4eLtzAeLhEgD1YQFQ8h5 3B8MJrTWe3jSYQ77lis4975NruJf3vEXu4qAWfLWlEkrjCseXO0TVK3Palro1igZSmab vPVA== X-Forwarded-Encrypted: i=1; AJvYcCUK6EyH5bmNcKcU5QaGI+p7KyOeh0MhVc+Uey8kOdmTfn2mOgBiGaeMitOxS4xvv6/y/lBa5TeEhSzBRYg/Jc3C@lists.infradead.org X-Gm-Message-State: AOJu0YwY4a05lNJxUGDx6HVfYGpih99CpYpjRa3WkEVvLaN3PelbbnhU KT9lwdZz5BqFRCmZ4byg2pM05+315J84049A0yNKk0KEvXtgqL4X X-Google-Smtp-Source: AGHT+IE346rXlPlagQTZcOHpZl4+DAe05+tRp5bqoGWXkgCQc9psXkFiWkYrSTnLTh/SBEscY60t2g== X-Received: by 2002:a05:6871:3a28:b0:251:2755:5a33 with SMTP id 586e51a60fabf-277d05f9b26mr18381175fac.39.1725509862578; Wed, 04 Sep 2024 21:17:42 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:13bd:b4e:4c0f:4c37]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d4fbd8d52esm2450216a12.32.2024.09.04.21.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 21:17:42 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: =?utf-8?q?Pali_Roh=C3=A1r?= , Helge Deller , "K. Y. Srinivasan" , Wei Liu , Dexuan Cui , Samuel Holland , Lyude Paul , Michal Simek , Hans de Goede , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 00/24] Convert serio-related drivers to use new cleanup facilities Date: Wed, 4 Sep 2024 21:17:05 -0700 Message-ID: <20240905041732.2034348-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_211744_079850_95BF92DA X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This series converts drivers found in drivers/input/serio as well as a few of input drivers using serio to use new __free() and guard() cleanup facilities that simplify the code and ensure that all resources are released appropriately. First patch introduces serio_pause_rx guard that pauses delivery of interrupts/data for a given serio port by calling serio_pause_rx() helper and automatically resumes it by calling serio_resume_rx() when needed. The following 8 patches make use if this new guard. The rest of the patches switch serio drivers to use guard(mutex), guard(spinlock*) and other cleanup functions to simplify the code. Thanks! Dmitry Torokhov (24): Input: serio - define serio_pause_rx guard to pause and resume serio ports Input: libps2 - use guard notation when temporarily pausing serio ports Input: alps - use guard notation when pausing serio port Input: byd - use guard notation when pausing serio port Input: synaptics - use guard notation when pausing serio port Input: atkbd - use guard notation when pausing serio port Input: sunkbd - use guard notation when pausing serio port Input: synaptics-rmi4 - use guard notation when pausing serio port in F03 Input: elo - use guard notation when pausing serio port Input: gscps2 - use guard notation when acquiring spinlock Input: hyperv-keyboard - use guard notation when acquiring spinlock Input: i8042 - tease apart interrupt handler Input: i8042 - use guard notation when acquiring spinlock Input: ps2-gpio - use guard notation when acquiring mutex Input: ps2mult - use guard notation when acquiring spinlock Input: q40kbd - use guard notation when acquiring spinlock Input: sa1111ps2 - use guard notation when acquiring spinlock Input: serport - use guard notation when acquiring spinlock Input: serio - use guard notation when acquiring mutexes and spinlocks Input: serio_raw - use guard notation for locks and other resources Input: serio-raw - fix potential serio port name truncation Input: sun4i-ps2 - use guard notation when acquiring spinlock Input: userio - switch to using cleanup functions Input: xilinx_ps2 - use guard notation when acquiring spinlock drivers/input/keyboard/atkbd.c | 8 +- drivers/input/keyboard/sunkbd.c | 5 +- drivers/input/mouse/alps.c | 4 +- drivers/input/mouse/byd.c | 5 +- drivers/input/mouse/synaptics.c | 6 +- drivers/input/rmi4/rmi_f03.c | 4 +- drivers/input/serio/gscps2.c | 114 +++++---- drivers/input/serio/hyperv-keyboard.c | 38 ++- drivers/input/serio/i8042.c | 327 +++++++++++++------------- drivers/input/serio/libps2.c | 28 ++- drivers/input/serio/ps2-gpio.c | 4 +- drivers/input/serio/ps2mult.c | 25 +- drivers/input/serio/q40kbd.c | 10 +- drivers/input/serio/sa1111ps2.c | 8 +- drivers/input/serio/serio.c | 164 +++++-------- drivers/input/serio/serio_raw.c | 125 ++++------ drivers/input/serio/serport.c | 27 +-- drivers/input/serio/sun4i-ps2.c | 8 +- drivers/input/serio/userio.c | 141 ++++++----- drivers/input/serio/xilinx_ps2.c | 15 +- drivers/input/touchscreen/elo.c | 8 +- include/linux/serio.h | 3 + 22 files changed, 487 insertions(+), 590 deletions(-)