Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp78374ybj; Fri, 8 May 2020 06:57:42 -0700 (PDT) X-Google-Smtp-Source: APiQypJNCdIwgw6o/7CxZem0f9hHa97vatt7mIsvFGm1NgbytsM+/6Xt7TN56XXByJttdHFofsPe X-Received: by 2002:a1c:1bcb:: with SMTP id b194mr17064914wmb.4.1588946262287; Fri, 08 May 2020 06:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588946262; cv=none; d=google.com; s=arc-20160816; b=Kd/MptKSwy6LNRp/R8T7HeU1RpjTE7kr+tMD/c2KPachj8RxCa4sA6XkQp2F5Lavt6 twokhGo3taiF/8K0IktEKTUtp/9B/DgFyZgJx7lfhVNweB3pnYI3pGhdXOQIrj0/IAwX ERIT5eNgBTqNKaB7JEFWnrOFYeC+/wY6qgONLh/7VlVjBW70z/hIOyy/dco16fxySPbp gn6dLeVZ6IgiI8FolJXzZItZbSJFwhb4TTmMZtR/djF8PWu3JNETB/8vJIcdAFTNG+QF 0lHhBhKHyKn8FahNQg4QDrpn95BFHQBK94DXHlxYG+fTQs+M5T63ZvfzMEd67UsiKCBR Xpbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=wCPph76GOeR60c+hQyugBAj5OUmF0oG8DlaPxILyDF0=; b=w2YArQqMqKT9vlbYwyGPtCito3ZbyEMxtQ1HyMAfZwLi3cMZTYmXwYRB8Nv4I8pXJN bmtRcZYv8I2nwU5cQ1uIRivFeVcahThvyEeq9s5CZ4uLkZib5q6AqJtYfC3GlAp/Kt64 /wiL4ori05BJx3gtaVeHKoYn3twEugEwdmzRFDZI+Obx0tXoLaNdC79zlfZexNKdoVYn zETEsStF4OlIZ+eu464iTBy7xgLqP4phDuPZNY7yy0z7i7qRDEwN+QHT9Lx2S2UCd3Wr 6UEOd4zEgJCWPbTe4oKCWF0dfjlPhar+UzLstnEJJozoaTJbqxPKc85TbOa+pb6Vh2Ns 50mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 73si1569390wrm.451.2020.05.08.06.57.18; Fri, 08 May 2020 06:57:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbgEHNyO (ORCPT + 99 others); Fri, 8 May 2020 09:54:14 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:42468 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbgEHNyO (ORCPT ); Fri, 8 May 2020 09:54:14 -0400 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 048Dib8I031165; Fri, 8 May 2020 09:54:02 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com with ESMTP id 30vtef2j5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 May 2020 09:54:02 -0400 Received: from SCSQMBX10.ad.analog.com (scsqmbx10.ad.analog.com [10.77.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 048Ds1rA040814 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Fri, 8 May 2020 09:54:01 -0400 Received: from SCSQMBX11.ad.analog.com (10.77.17.10) by SCSQMBX10.ad.analog.com (10.77.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 8 May 2020 06:53:59 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by SCSQMBX11.ad.analog.com (10.77.17.10) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Fri, 8 May 2020 06:53:59 -0700 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 048Drpwo030263; Fri, 8 May 2020 09:53:57 -0400 From: Alexandru Ardelean To: , CC: , , Alexandru Ardelean Subject: [RFC PATCH 04/14] iio: core,buffer: wrap iio_buffer_put() call into iio_buffers_put() Date: Fri, 8 May 2020 16:53:38 +0300 Message-ID: <20200508135348.15229-5-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508135348.15229-1-alexandru.ardelean@analog.com> References: <20200508135348.15229-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 Content-Type: text/plain X-ADIRoutedOnPrem: True X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-08_13:2020-05-08,2020-05-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=2 clxscore=1015 phishscore=0 mlxlogscore=913 adultscore=0 mlxscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005080122 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The name (and the wrapper) seems superfluous now, but when more buffers will be attached to the IIO device this will be a bit more useful. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h | 4 ++++ drivers/iio/industrialio-buffer.c | 10 ++++++++++ drivers/iio/industrialio-core.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/iio/iio_core.h b/drivers/iio/iio_core.h index fd9a5f1d5e51..39ec0344fb68 100644 --- a/drivers/iio/iio_core.h +++ b/drivers/iio/iio_core.h @@ -51,6 +51,8 @@ void iio_buffer_free_sysfs_and_mask(struct iio_dev *indio_dev); #define iio_buffer_poll_addr (&iio_buffer_poll) #define iio_buffer_read_outer_addr (&iio_buffer_read_outer) +void iio_device_buffers_put(struct iio_dev *indio_dev); + void iio_disable_all_buffers(struct iio_dev *indio_dev); void iio_buffer_wakeup_poll(struct iio_dev *indio_dev); @@ -66,6 +68,8 @@ static inline int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev) static inline void iio_buffer_free_sysfs_and_mask(struct iio_dev *indio_dev) {} +static inline void iio_device_buffers_put(struct iio_dev *indio_dev) {} + static inline void iio_disable_all_buffers(struct iio_dev *indio_dev) {} static inline void iio_buffer_wakeup_poll(struct iio_dev *indio_dev) {} diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 3b1071deba00..93f187455461 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1371,6 +1371,16 @@ void iio_buffer_free_sysfs_and_mask(struct iio_dev *indio_dev) iio_free_chan_devattr_list(&buffer->scan_el_dev_attr_list); } +void iio_device_buffers_put(struct iio_dev *indio_dev) +{ + struct iio_buffer *buffer = indio_dev->buffer; + + if (!buffer) + return; + + iio_buffer_put(buffer); +} + /** * iio_validate_scan_mask_onehot() - Validates that exactly one channel is selected * @indio_dev: the iio device diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 462d3e810013..32c489139cd2 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1481,7 +1481,7 @@ static void iio_dev_release(struct device *device) iio_device_unregister_eventset(indio_dev); iio_device_unregister_sysfs(indio_dev); - iio_buffer_put(indio_dev->buffer); + iio_device_buffers_put(indio_dev); ida_simple_remove(&iio_ida, indio_dev->id); kfree(indio_dev); -- 2.17.1