Received: by 2002:a05:7412:a9a8:b0:f9:92ae:e617 with SMTP id o40csp91490rdh; Wed, 20 Dec 2023 17:21:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEk80EZePm8OvHyy2cFTRafah1fRF96upY1kSVX/daFcbFB6/uvWL/kP9221oBY3ytudjDg X-Received: by 2002:a17:906:4116:b0:a26:8aeb:c363 with SMTP id j22-20020a170906411600b00a268aebc363mr1254388ejk.60.1703121668295; Wed, 20 Dec 2023 17:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703121668; cv=none; d=google.com; s=arc-20160816; b=WfFKtqUiWN3VH8T6og0pYWw09/qFO8SUcKsBEJbqeR/CiWP1QKox6ceoXXfZvhF7p9 td83ZtkB1gzp3LrD9l1sGnhbslhHtPUW7VxDUrRA5pFvlJ/tAb57wwP4Mgi9bAwqo9JS h9/Y/EYLbY6/PeFxQWDkYIZzrIocrBhl7MR+c5lSRUfbH6rJBz+jw6cv08NO0bBOeie0 X9nJpa19C2P7vVdTUsvFXp9xCMDdysGu2hpbLQjKk2mL4JkXEInRslMmIL0pI05MuXub 9cAsm4XSvPgFCmlQf86xv5CZzwg/KyBMEK03Y9/QFcpUKJnF3NNDINfQmAZPqtOEb7CZ uz+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=oEv+hdHh4Z2txdpbzpok/LPO5P0UTDSHNAO1ulhD6LQ=; fh=GNOA1jdeAuH+tfAEzFx15vIukVGFZnqrW9xHApUHjl0=; b=nnbe4YT65KOXHzUuBWW4Ti+G30Fopiupapi+d+Ax9dNWR6PhUV+pP8GPZS9JlNUXKO MJPv2/xdbsYZ3W9+vDVsqcrPSIPkMdjmYvNQuWVVV9hUvZ6w7mpiQMF1WvLZDO41oV6k Lf8yKRz8qPB70Oj7+Ve2qOor34E/cFreAhTnTBU7CS+DFbaKndzBjvV+ArmcE59dJVCZ 9ax6yHUpmUqqrfGa16KFoGrJg5ZcNA0Gtzh5mEx/xqzyyuyWREJB+ROndIdZf7yjTGdI dzTL6vjLV/ZAoawSjiJUJAwGyhQ4HREXMObPI3XQSfKnr98O8mIAhsmxY/4Vrb60eA7I KawA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RXUdcbAj; spf=pass (google.com: domain of linux-kernel+bounces-7718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a1-20020a1709063a4100b00a23334f9a18si359206ejf.877.2023.12.20.17.21.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 17:21:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RXUdcbAj; spf=pass (google.com: domain of linux-kernel+bounces-7718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0F8EC1F24463 for ; Thu, 21 Dec 2023 01:21:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CEAF1843; Thu, 21 Dec 2023 01:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RXUdcbAj" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71E054404; Thu, 21 Dec 2023 01:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6d9338bc11fso287241b3a.1; Wed, 20 Dec 2023 17:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703121657; x=1703726457; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oEv+hdHh4Z2txdpbzpok/LPO5P0UTDSHNAO1ulhD6LQ=; b=RXUdcbAjyMLJrIslWnW3NDObskwMFO81FIlnCKMazmjI9OvBZhJDI4LPc9aU6kHD4c a8Y/GmxKF/qeBGI4zQxoOZ3aD1nboUVV3zSXV+QUA2acGbeCRD2/kvekWG/njmM9dZCT JOGe9pumXuBPaCuM4yHh0Eu5I5zOzElJx8A2MCgtoYMY7FYO8Ok2ZnqBw+hxJm9fl8mW tScoY56OMZEQril78nqsX2eaCu7uNeGyo+cPQHwjAhPqg2sYVwb2LOfVm0d+wqLISPAr Dmt9eicuey34BXJRGPUNKK6HpAJ+oez4na8t444MABmcZ2VgmrHcqUFILKhRnCnPo2Z+ V8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703121657; x=1703726457; 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=oEv+hdHh4Z2txdpbzpok/LPO5P0UTDSHNAO1ulhD6LQ=; b=Xcdjbg9BwW0wnCU5YPYEupVrVpzAeZ+EV7AQCqx3r46FZBV0vewaIhXEModyMFJIvi vic3RILpFF+vGcjn07t2jml9YUO5EnbXHG2JddepltgqFOElYrG0VP0sCf/puNnFj0tx +PlsiXBunAUxrHu1LqjEyWViHMQWirpHbm5qBkiu1hkPrhwLXBOunEN0LDvfcrBTbu/E SGayCAJ5apKyjbe2OzEwpVG9gMGcoInLhBvYWNBeauAhB6k/83zDPxZEMJd/2vGbKDOw n3eoTKxsT45LNQrcWR+qmxfvCRfFelmI+CQ0Qnqkdfu/q2dmmy5zGT7k6KdaQbaEH2Gf 8JQg== X-Gm-Message-State: AOJu0YzoU/sW5NOOK9MkTjeFmeEud730nZYv//el+kjKQonpOPtlGZtY ga3YaukWfb2v1jz+W/L5JKunWYi/pOM= X-Received: by 2002:a05:6a20:12d4:b0:194:dee3:3120 with SMTP id v20-20020a056a2012d400b00194dee33120mr821411pzg.94.1703121657564; Wed, 20 Dec 2023 17:20:57 -0800 (PST) Received: from rigel.home.arpa (60-241-235-125.tpgi.com.au. [60.241.235.125]) by smtp.gmail.com with ESMTPSA id x1-20020a056a00270100b006d088356541sm375959pfv.104.2023.12.20.17.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 17:20:57 -0800 (PST) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org, andy@kernel.org Cc: Kent Gibson Subject: [PATCH v2 0/5] gpiolib: cdev: guard tidying Date: Thu, 21 Dec 2023 09:20:35 +0800 Message-Id: <20231221012040.17763-1-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series contains some tidying up of gpiolib-cdev following the recent adoption of guard(). The first patch is a fix to protect gpio_ioctl() from having the gpio chip removed while the ioctl is in progress. The next couple of patches are minor fixes inspired by recent submissions and reviews for gpiolib.c. Patch 2 adds a missing include. Patch 3 switches allocation of struct linereq from kzalloc() to kvzalloc() as it can be larger than one page - even more so after the recent relocation of debounce_period_us. The final two patches replace wrapper functions with guards. Patch 4 tidies up the functions that use a guard on the linereq config_mutex. Patch 5 tidies up the functions that use a guard on the gpio_device. Changes v1 -> v2: - add patch 1 to protect gpio_ioctl() from chip removal - improve commit comment (patch 3) - use guard(rwsem_read) rather than rolling our own (patch 5) Cheers, Kent. Kent Gibson (5): gpiolib: cdev: add gpio_device locking wrapper around gpio_ioctl() gpiolib: cdev: include overflow.h gpiolib: cdev: allocate linereq using kvzalloc() gpiolib: cdev: replace locking wrappers for config_mutex with guards gpiolib: cdev: replace locking wrappers for gpio_device with guards drivers/gpio/gpiolib-cdev.c | 257 ++++++++++-------------------------- 1 file changed, 70 insertions(+), 187 deletions(-) -- 2.39.2