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: 88905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2051718vqo; Sun, 30 Apr 2023 02:44:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4PMeyOjppLDEgc60TKyAilqE3LBD3Fe4QE9ottdTBNYYRBKhLUvZdwR/ydGbacskb1rWGP X-Received: by 2002:a05:6a20:a121:b0:f6:15f3:ca36 with SMTP id q33-20020a056a20a12100b000f615f3ca36mr14438210pzk.50.1682847860565; Sun, 30 Apr 2023 02:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682847860; cv=none; d=google.com; s=arc-20160816; b=YI92w9+zI3nDvfACvnxGrX1W6RXtYvOgAlROwcCgw2bN2Bo5QxB03gHc2n+3B7pzH9 dn60Ls55II09iHfxd6TlY+bxKpAkU0YKEHRH6EJ8rxu1Ic1R2fF6tWkQAuXezFpncFer GFBlU1RmoHZRMh/MaA4+WlR8uvHWugyzyNulILFPmywroVppiYyXtfdfWFC3pis72kvv vFnRtBo4HuaUTrEhm9lmyzRYNlQDJBD1jvVahuO/lKOpeHcik3KSyB/M8YDkOdLVjMbT 9L6YQNiSJo1TJVIPuQHXelocpVlGgS9t8L1KzU0YXXo6VO1R/lzbesCgLElZJ8pMp2IV aqVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RqDQjPSPVAS9useuh9rd9llDLOh/Ap8G6Tllign/gys=; b=GA7XznXTA8CK+jLykNLoifu59E6BSALSrJNNr5T/I1VS5ED21zTgIX+hIiUrp1jRKy cHzm4kqHLNRVT5l6laQR5ysMJBBmnczB754NkhZWGNqmPXWWO9qoz4eilDqzBOZbkRgZ qV73Ux/czP31JcDMoYZnyxcAQvahze/1YOeNHR2w1y/nSgltUrQfg8D+DtmQg97vryzb dULbs0W9FJ4I9vHfdlOYbohv2AxbMEs6G3z+xI8DlAtPuZ/P+wM08WezZmiFMwMvIsGZ lzjj9NOm6WoK7hAnFQycKxEayJJ1EjAwahaQgyDI/4eWz0ZUnrBdxeY7YoF0mMHr1lFQ qFCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=RUNDth6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a63f40c000000b005030a59a81dsi25309228pgi.159.2023.04.30.02.44.08; Sun, 30 Apr 2023 02:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=RUNDth6g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbjD3Jfs (ORCPT + 99 others); Sun, 30 Apr 2023 05:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbjD3Jfq (ORCPT ); Sun, 30 Apr 2023 05:35:46 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5211910F9 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764593878280857075?= X-GMAIL-MSGID: =?utf-8?q?1764593878280857075?= 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);