From patchwork Fri Nov 18 08:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramona Bolboaca X-Patchwork-Id: 22188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp65933wrr; Fri, 18 Nov 2022 00:35:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4YjLcio5evwZdmOmyv3YoTkyW96SlV4oh9CsG3bFogDQ7KXjW6EeuKodc9r7/ixh/h931U X-Received: by 2002:a62:1a05:0:b0:56c:1277:d056 with SMTP id a5-20020a621a05000000b0056c1277d056mr6762379pfa.23.1668760535089; Fri, 18 Nov 2022 00:35:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668760535; cv=none; d=google.com; s=arc-20160816; b=aQZVqncXJ5mQhO+DVguqg+8xiBaHojP28C/tM4tb//OngWGYtx6GQtcDI2eRDTPcQA mtDdqmBRMrZrYJVwAU1OMIfQDWFZAVOxk/wV90shUin7jXS9TgmmUNh2qIOPjlCMilEn 7vbzDWaOvw4InncABumagLYMXRUF+yHZbDfM5vg9xO8NozP8YAuaU+mr9RQAZImIlxuT hAB0IL6qIJ9z8C6rDnowNHNoP7uXLAt5pnRTwGGMm6lifA3sRVj6Tcd72PclZblMsK3o uafGtleU2vqn3i898nyjfs2+ASxrVcX1jI3SCT4jvTj2SN5f0KmD8GcHpkYj/lrH51SH aIxA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=98hK/Cc3j0z21U8tYHKATmDkXZF+vHuF/ko6WYqztZU=; b=UNcydDP83PcJH40mmX9Jn2UDD65TjZW/bbkT96rJbZPeddHjtBTyTk3wAN15TEF4+g k4kllfiK1mjM7FIbacVO4MjkSdnTVsDReacCPQG6y8+uHNX+79gesV2EStNTqr6xWp6Z hIXNUQEHRd/Lss9WVN1bm0+bFUtLbk89re+WcCM9COwTVqEHZQcQStVMkgu7EC5ra/1J BZVQhNWcN7ftnxq6EIdoIfwKaSUB5wzU4R1x3fW0fdfxutMl6vw2GsE59iNi3dgN/TCM h2tnbM8UaMc42ia2rlYFBQOy60Fow13axx2BAgOCf3HgJXdxX8tEutaT8U7kWw0hZcrb 9bgw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b004707d007610si3203207pgd.696.2022.11.18.00.35.14; Fri, 18 Nov 2022 00:35:35 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241445AbiKRId2 (ORCPT + 99 others); Fri, 18 Nov 2022 03:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241474AbiKRIcY (ORCPT ); Fri, 18 Nov 2022 03:32:24 -0500 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905CC57B48; Fri, 18 Nov 2022 00:31:45 -0800 (PST) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AI5S8Ut003138; Fri, 18 Nov 2022 03:31:36 -0500 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3kx0n9stp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Nov 2022 03:31:36 -0500 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 2AI8VZfc041449 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Nov 2022 03:31:35 -0500 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Fri, 18 Nov 2022 03:31:34 -0500 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; Fri, 18 Nov 2022 03:31:34 -0500 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; Fri, 18 Nov 2022 03:31:33 -0500 Received: from rbolboac.ad.analog.com ([10.48.65.139]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 2AI8VMVE021746; Fri, 18 Nov 2022 03:31:28 -0500 From: Ramona Bolboaca To: , , , CC: Ramona Bolboaca Subject: [PATCH v3 01/10] iio: adis: add '__adis_enable_irq()' implementation Date: Fri, 18 Nov 2022 10:31:09 +0200 Message-ID: <20221118083118.9641-2-ramona.bolboaca@analog.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118083118.9641-1-ramona.bolboaca@analog.com> References: <20221118083118.9641-1-ramona.bolboaca@analog.com> MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: 8LI6JOa35pi7XoR_1O8R24ZnxGrw4ZZe X-Proofpoint-GUID: 8LI6JOa35pi7XoR_1O8R24ZnxGrw4ZZe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_06,2022-11-17_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=985 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211180053 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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?1749822247026655807?= X-GMAIL-MSGID: =?utf-8?q?1749822247026655807?= Add '__adis_enable_irq()' implementation which is the unlocked version of 'adis_enable_irq()'. Signed-off-by: Ramona Bolboaca --- changes in v3: - new patch drivers/iio/imu/adis.c | 26 +++++++++----------------- include/linux/iio/imu/adis.h | 12 +++++++++++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index f7fcfd04f659..cfcb4abeb5db 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -270,23 +270,19 @@ EXPORT_SYMBOL_NS(adis_debugfs_reg_access, IIO_ADISLIB); #endif /** - * adis_enable_irq() - Enable or disable data ready IRQ + * __adis_enable_irq() - Enable or disable data ready IRQ (unlocked) * @adis: The adis device * @enable: Whether to enable the IRQ * * Returns 0 on success, negative error code otherwise */ -int adis_enable_irq(struct adis *adis, bool enable) +int __adis_enable_irq(struct adis *adis, bool enable) { - int ret = 0; + int ret; u16 msc; - mutex_lock(&adis->state_lock); - - if (adis->data->enable_irq) { - ret = adis->data->enable_irq(adis, enable); - goto out_unlock; - } + if (adis->data->enable_irq) + return adis->data->enable_irq(adis, enable); if (adis->data->unmasked_drdy) { if (enable) @@ -294,12 +290,12 @@ int adis_enable_irq(struct adis *adis, bool enable) else disable_irq(adis->spi->irq); - goto out_unlock; + return 0; } ret = __adis_read_reg_16(adis, adis->data->msc_ctrl_reg, &msc); if (ret) - goto out_unlock; + return ret; msc |= ADIS_MSC_CTRL_DATA_RDY_POL_HIGH; msc &= ~ADIS_MSC_CTRL_DATA_RDY_DIO2; @@ -308,13 +304,9 @@ int adis_enable_irq(struct adis *adis, bool enable) else msc &= ~ADIS_MSC_CTRL_DATA_RDY_EN; - ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc); - -out_unlock: - mutex_unlock(&adis->state_lock); - return ret; + return __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc); } -EXPORT_SYMBOL_NS(adis_enable_irq, IIO_ADISLIB); +EXPORT_SYMBOL_NS(__adis_enable_irq, IIO_ADISLIB); /** * __adis_check_status() - Check the device for error conditions (unlocked) diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 515ca09764fe..f5432f3b2b22 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -402,7 +402,17 @@ static inline int adis_update_bits_base(struct adis *adis, unsigned int reg, __adis_update_bits_base(adis, reg, mask, val, sizeof(val)); \ }) -int adis_enable_irq(struct adis *adis, bool enable); +static inline int adis_enable_irq(struct adis *adis, bool enable) +{ + int ret; + + mutex_lock(&adis->state_lock); + ret = __adis_enable_irq(adis); + mutex_unlock(&adis->state_lock); + + return ret; +} + int __adis_check_status(struct adis *adis); int __adis_initial_startup(struct adis *adis);