From patchwork Tue Sep 20 11:28:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 12981957 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 AC70CC54EE9 for ; Tue, 20 Sep 2022 11:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=SWnrlg4YNAXxMzYW4xngZjG4yrN232ECGY1rRDt9j7Y=; b=c+Pz6w4K+5plnA mM41pMMAclcpaOQZEL11fahHC3Licrm+nVmn9cpwDkqkA/nt4kIK+HPOBRNw4NFqFXvxKbz7Y0dKe cwLSIGWDBMuCvb+bhrb6Ew2GxsPVg/uDp/GNizp0D4Z56W7jy/389FSjF5d6aAOnun3AcYjHn7LHS ENngzKl+WClwvCBe4vuVVZuLQZX1COhP75eWMtvavQEGsR9x6Ezt9B6mF8NmNftCS0V1UcBu0nTl/ ot/VOzCTq/uEr/zoKLgyJQGHlWqSj7EqJFT6bTzq6K74r8W1YHLDJaZPWhg5W/uzXsb+S8SVSsTJj ZNDOucXr8jJh2H7Vmstg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oabQB-003I6b-EJ; Tue, 20 Sep 2022 11:28:11 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oabQ7-003I2e-1x; Tue, 20 Sep 2022 11:28:09 +0000 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28K81m58025096; Tue, 20 Sep 2022 07:27:47 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3jpn468r05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 07:27:46 -0400 Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 28KBRjx6060583 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 20 Sep 2022 07:27:45 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 20 Sep 2022 07:27:44 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 20 Sep 2022 07:27:44 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 20 Sep 2022 07:27:44 -0400 Received: from nsa.ad.analog.com ([10.44.3.57]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 28KBR4UM021723; Tue, 20 Sep 2022 07:27:06 -0400 From: =?utf-8?q?Nuno_S=C3=A1?= To: , , , , CC: Chunyan Zhang , Michael Hennerich , Martin Blumenstingl , Sascha Hauer , Cixi Geng , Kevin Hilman , Vladimir Zapolskiy , Pengutronix Kernel Team , Alexandru Ardelean , "Fabio Estevam" , Andriy Tryshnivskyy , Haibo Chen , "Shawn Guo" , Hans de Goede , Miquel Raynal , Jerome Brunet , "Heiko Stuebner" , Florian Boor , Ciprian Regus , Lars-Peter Clausen , Andy Shevchenko , "Jonathan Cameron" , Neil Armstrong , "Baolin Wang" , Jyoti Bhayana , =?utf-8?q?Nuno_S=C3=A1?= , Chen-Yu Tsai , Orson Zhai Subject: [PATCH 00/15] Make 'mlock' really private Date: Tue, 20 Sep 2022 13:28:06 +0200 Message-ID: <20220920112821.975359-1-nuno.sa@analog.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: ctBCY4ybaJjBC-Xu6-vuJs0JpagJPQLg X-Proofpoint-GUID: ctBCY4ybaJjBC-Xu6-vuJs0JpagJPQLg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-20_02,2022-09-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 clxscore=1011 spamscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 mlxlogscore=524 adultscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209200068 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_042807_180135_BC488A4D X-CRM114-Status: GOOD ( 14.35 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org This patchset cleans all the drivers directly using the iio_device 'mlock'. This lock is private and should not be used outside the core (or by using proper helpers). Most of the conversions where straight, but there are some that really need extra looking. Mainly patches [13/15] and [14/15] were a bit hacky since iio_device_claim_direct_mode() does not fit 100%. The reason is that we want to check if the device is buffering and do something if it is (in which case the API return -EBUSY and released the lock. I just used a combinations of locks to get around this (hopefully I did not messed up). I was also not sure if patch [1/15] deserves a Fixes: tag but, to me, it is really fixing a potential race so I added it. Note that this series was only compiled tested using allyesconfig for ARM. I ran 'git grep' to make sure there were no more users of 'mlock'. Hopefully I covered them all... Nuno Sá (15): iio: adc: ad_sigma_delta: do not use internal iio_dev lock iio: adc: ad799x: do not use internal iio_dev lock iio: adc: axp288_adc: do not use internal iio_dev lock iio: adc: imx7d_adc: do not use internal iio_dev lock iio: adc: lpc32xx_adc: do not use internal iio_dev lock iio: adc: ltc2947-core: do not use internal iio_dev lock iio: adc: meson_saradc: do not use internal iio_dev lock iio: adc: rockchip_saradc: do not use internal iio_dev lock iio: adc: sc27xx_adc: do not use internal iio_dev lock iio: adc: vf610_adc: do not use internal iio_dev lock iio: common: scmi_iio: do not use internal iio_dev lock iio: fyro: itg3200_core: do not use internal iio_dev lock iio: health: max30100: do not use internal iio_dev lock iio: health: max30102: do not use internal iio_dev lock iio: core: move 'mlock' to 'struct iio_dev_opaque' drivers/iio/TODO | 3 --- drivers/iio/adc/ad799x.c | 18 ++++++++----- drivers/iio/adc/ad_sigma_delta.c | 8 +++--- drivers/iio/adc/axp288_adc.c | 8 ++++-- drivers/iio/adc/imx7d_adc.c | 13 ++++++---- drivers/iio/adc/lpc32xx_adc.c | 10 +++++--- drivers/iio/adc/ltc2497-core.c | 7 +++-- drivers/iio/adc/ltc2497.h | 2 ++ drivers/iio/adc/meson_saradc.c | 10 +++++--- drivers/iio/adc/rockchip_saradc.c | 14 ++++++---- drivers/iio/adc/sc27xx_adc.c | 12 ++++++--- drivers/iio/adc/vf610_adc.c | 30 ++++++++++++++-------- drivers/iio/common/scmi_sensors/scmi_iio.c | 9 +++++-- drivers/iio/gyro/itg3200_core.c | 9 ++++--- drivers/iio/health/max30100.c | 24 ++++++++++++----- drivers/iio/health/max30102.c | 25 +++++++++++++----- drivers/iio/industrialio-buffer.c | 29 ++++++++++++--------- drivers/iio/industrialio-core.c | 18 +++++++------ drivers/iio/industrialio-event.c | 4 +-- drivers/iio/industrialio-trigger.c | 12 ++++----- include/linux/iio/gyro/itg3200.h | 2 ++ include/linux/iio/iio-opaque.h | 2 ++ include/linux/iio/iio.h | 3 --- 23 files changed, 175 insertions(+), 97 deletions(-)