From patchwork Sun Apr 30 09:35:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13227176 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B1E2C77B60 for ; Sun, 30 Apr 2023 09:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229878AbjD3Jfq (ORCPT ); Sun, 30 Apr 2023 05:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjD3Jfq (ORCPT ); Sun, 30 Apr 2023 05:35:46 -0400 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7481E2685 for ; Sun, 30 Apr 2023 02:35:40 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id t3SzpqrC7QSvkt3SzpzF7s; Sun, 30 Apr 2023 11:35:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682847337; bh=RqDQjPSPVAS9useuh9rd9llDLOh/Ap8G6Tllign/gys=; h=From:To:Cc:Subject:Date; b=RUNDth6gqurw4DEOjvsaRSu2xq/FQHGVT+f3/JQu3U9X7FY7BvbutZrLNpzIXOu0x kkBDTyeLSBa5AqdDaF93rjDvd4/2+m+wjBBI062L/SJyXcN1LBHJ069Qw6vfQMzZzt VEB3od6qm5hASCf+X/c0g3Ljj5Qvt6TithpzQnDwWFalPal929YXvKCzV7u51le/T5 4/zfvqdclM01Gv9HwrEQ//HeOq/6c2VPuUblv/OnkF6Rnu0D0C4mx41XbV97JDPVTZ TtwsX44gQSoW+vDqTsSmC3XnxpMakMIdJ/faCcRssRu5p4nxISu0mrMq4RAk1jgFMV S5Hb6uMU/zPTg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 30 Apr 2023 11:35:37 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Mark Brown Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-spi@vger.kernel.org Subject: [PATCH] spi: Use non-atomic xxx_bit() functions Date: Sun, 30 Apr 2023 11:35:35 +0200 Message-Id: <6b8f405145d3d57a8026dc61ca3f1ae70d690990.1682847325.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Accesses to 'minors' are guarded by the 'device_list_lock' mutex. So, it is safe to use the non-atomic version of (set|clear)_bit() in the corresponding sections. Signed-off-by: Christophe JAILLET --- drivers/spi/spidev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 39d94c850839..132fecc02eba 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -812,7 +812,7 @@ static int spidev_probe(struct spi_device *spi) status = -ENODEV; } if (status == 0) { - set_bit(minor, minors); + __set_bit(minor, minors); list_add(&spidev->device_entry, &device_list); } mutex_unlock(&device_list_lock); @@ -840,7 +840,7 @@ static void spidev_remove(struct spi_device *spi) list_del(&spidev->device_entry); device_destroy(spidev_class, spidev->devt); - clear_bit(MINOR(spidev->devt), minors); + __clear_bit(MINOR(spidev->devt), minors); if (spidev->users == 0) kfree(spidev); mutex_unlock(&device_list_lock);