From patchwork Thu Sep 5 04:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13791715 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 556ABCD4F57 for ; Thu, 5 Sep 2024 04:27:31 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Mdzi002JGx1/VTYSFinhnta06n3PxzWkqyJNw8JR4ro=; b=X2bDYeo9i841gWSWIDommOSumr quQXxhvT7QBLwiUOe/qpwALPreKxyPaU/61aSErg2qHFpE2UWR2dqvpEXmHfi7x0k+LueIy1TiM5v dFfnIzikhbrLxTrgBPkEzlrmTA/0okZQBPqPvYPhznmBB3r41hIDzwaG6ljbzv4V60Y9tj+9YnsoZ vhxXZPdTDCcC83ZeMdVMo5tHAA1HpbqFo1pQ9faD8ucnk3lgqnpFbFhPa0kEA6aDm62SgY1ZSBzTm aAgtv6rmgId6bm5T0jolQpBRWUVqgsgOYXMIpPhV8319JzLm36mjUvexwqze3Rw556yUujfhLj3jK cY+dXYJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm45a-00000006vam-3dA8; Thu, 05 Sep 2024 04:27:22 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3wU-00000006tQ7-1siZ for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 04:17:59 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2700d796019so218472fac.2 for ; Wed, 04 Sep 2024 21:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725509877; x=1726114677; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mdzi002JGx1/VTYSFinhnta06n3PxzWkqyJNw8JR4ro=; b=VecPmjgH9QNICiArHhS09dri4+efID87IcWcWBrS0xwgAf+FZ1HYWQwTQb39/7+qSN v8TsORnLAHFck0anQYE9/qSn2+Hoslplnk9S2chycrgE74Rc0Jn/9daGBFbaZC8cykJa 0vKzXszgCCS7OhAnkBl4ECU3Cu4X5XPvVZbLitwyNh72fExyLu+4OQSXJzHktRl63ETB y7cfcy8GISfJyBruJjMHlumx9Je9jJQ/bRfr6NpOFxGyZJOBk/9r9G/oVRB4SFdg/XEM kpWqnkv8hPpJ1PUctGbxBakdjzPJnq9njucLmEuKBf9DV8zXnNjADwOMgThrQlEtlpc3 /3Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725509877; x=1726114677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mdzi002JGx1/VTYSFinhnta06n3PxzWkqyJNw8JR4ro=; b=YKM+i8x1ptx62XxpOPTAua92dqgsy3KIbxg4Gmhun2NVrSG3dqiEDf/BfeIWJSDSSq pHjAIwKPuYdIRebjXJjqc9/Vl09bNDFCP1taAdeEEisn1aBfhHlu7F/znF4PQoA+BX5g QPVMIwZ4y6i1q1WYJSVsXp28277KA7HaDCezbeXVAS1zmkSXjdhBWdbNDH+EDmG2j19M j6mOAV+JtlGTbdh+Lyyb6zIWq1ivQPZCstiRzkUjkpDmrgKMCLAUT/Logh4AJ0R5lgs0 O5BBuQUdGFKO/+VZrNK7wjxDnyyacaRqC7Z0kqUSiT8hX9InmnDXqMDvteem5TlvXYYR yFmg== X-Forwarded-Encrypted: i=1; AJvYcCUkLhyI+cnKOFf8hAfTguBCSgIBH37530JAyOnv8rCdvzQ75l5OgxovM3Capxi0/hp9OYla+fnXOPShc4c5gYDT@lists.infradead.org X-Gm-Message-State: AOJu0Yw/Cv9Jfl9E5Mz7DBKmXItEvPz1X/Zgq/j5vOodGy861X+48wy9 5Q9TaGJ+o0BknmySsraEbvTYgqTyh8wU3tU77WyKXO/izg3GnPok X-Google-Smtp-Source: AGHT+IEeegP8PYdaxOx1oJdq99u2b/mnBeID80CKAiS5INtYMrMJc2IOIAmttT7NOBEVZS4HWjLcJw== X-Received: by 2002:a05:6870:3d8c:b0:270:1dab:64a9 with SMTP id 586e51a60fabf-277c8055c7dmr17330298fac.14.1725509877129; Wed, 04 Sep 2024 21:17:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 21:17:56 -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 09/24] Input: elo - use guard notation when pausing serio port Date: Wed, 4 Sep 2024 21:17:14 -0700 Message-ID: <20240905041732.2034348-10-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240905041732.2034348-1-dmitry.torokhov@gmail.com> References: <20240905041732.2034348-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_211758_509151_1B8983C9 X-CRM114-Status: GOOD ( 11.43 ) 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 Using guard notation makes the code more compact and error handling more robust by ensuring that serio ports are resumed in all code paths when control leaves critical section. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/elo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c index eb883db55420..ad209e6e82a6 100644 --- a/drivers/input/touchscreen/elo.c +++ b/drivers/input/touchscreen/elo.c @@ -225,10 +225,10 @@ static int elo_command_10(struct elo *elo, unsigned char *packet) mutex_lock(&elo->cmd_mutex); - serio_pause_rx(elo->serio); - elo->expected_packet = toupper(packet[0]); - init_completion(&elo->cmd_done); - serio_continue_rx(elo->serio); + scoped_guard(serio_pause_rx, elo->serio) { + elo->expected_packet = toupper(packet[0]); + init_completion(&elo->cmd_done); + } if (serio_write(elo->serio, ELO10_LEAD_BYTE)) goto out;