Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1631478ybz; Sun, 26 Apr 2020 00:40:34 -0700 (PDT) X-Google-Smtp-Source: APiQypIGSijddKRvu2vw8d2SH4n6z08O9LXuW9NUlTwimUR9GEq6bTbKnVXEEep5Q7wvm/UUBrFX X-Received: by 2002:aa7:cdd9:: with SMTP id h25mr14688147edw.17.1587886834547; Sun, 26 Apr 2020 00:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587886834; cv=none; d=google.com; s=arc-20160816; b=OVH7oAKCVVMWE7h/xa1Zytsh3Ukc4dOR6pw0NalrcrK68VEOSYdni8J+D3QQEh5ZfS wVV3VK397+/77CYYYYPcWFBdON0+i7nXKGrqWe0ZpJPdcSwALkfw9ew4WtMGFIol9xjx MeeGQ8vX61yxDg0OtTk1IGKAcS9onGQA2UnrH47UKRhKNGGagOGio7QwsOvZw5gjAmaO hdAliXND0b7P4J/lynUiNwXNYln8UYF/7kVVGD6861MFvWIfvUBODFZn3df3aUgAACk5 Lyh2hry5xXDMXXqBfcEDjUIZPDddh30Rk1Ci5LnFFHjWmWWIrb61E28mJ7C28cc2QLqV 3AVQ== 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=u4jIGVa0DBvLv7eMNv46HC7DnyrSwZPZJt6gqRY0prc=; b=jPw1Poa/bnTMDs5OCXwa7Eytv4V04dQWIRv7Zt8Yij65/U2Z5YDag6Kv2y+9CjGxvc 9ijpwZW+hvqNDTj+bZHC2VnwLJ6YmJQeG/gDxEDf7n2Fr5ooVOo9EiguLhzcvevAvXBC Mk5Wb7Go/ajUWH1lSk92nbKqbte7zPfOEvubOVoxL79UrIOPi0CuF0VRVP6havvHWmJm Vtg4nEdq4hT4GTgYXYpBJ57undKQoM1klGHVO9WJBmyf11TD5Ii1s/YnNMXnJRyzWTiw U9SUT7CK83yovrFv/9hh95iHCgfvIH3ECLMet0tlU2f4/YZBpvBefN6uEQlDfc3AxdRt ltpA== 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 22si6355016ejw.409.2020.04.26.00.40.11; Sun, 26 Apr 2020 00:40:34 -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 S1726259AbgDZHib (ORCPT + 99 others); Sun, 26 Apr 2020 03:38:31 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:1610 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726165AbgDZHiS (ORCPT ); Sun, 26 Apr 2020 03:38:18 -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 03Q7Yhrj014799; Sun, 26 Apr 2020 03:38:05 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com with ESMTP id 30mn4j2728-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 26 Apr 2020 03:38:05 -0400 Received: from SCSQMBX11.ad.analog.com (scsqmbx11.ad.analog.com [10.77.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 03Q7c3l2028386 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Sun, 26 Apr 2020 03:38:03 -0400 Received: from SCSQMBX11.ad.analog.com (10.77.17.10) by SCSQMBX11.ad.analog.com (10.77.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Sun, 26 Apr 2020 00:38:02 -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; Sun, 26 Apr 2020 00:38:02 -0700 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 03Q7bqdt011885; Sun, 26 Apr 2020 03:37:54 -0400 From: Alexandru Ardelean To: , CC: , , , Alexandru Ardelean Subject: [PATCH v5 1/6] iio: buffer: add back-ref from iio_buffer to iio_dev Date: Sun, 26 Apr 2020 10:38:12 +0300 Message-ID: <20200426073817.33307-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200426073817.33307-1-alexandru.ardelean@analog.com> References: <20200426073817.33307-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.138,18.0.676 definitions=2020-04-25_14:2020-04-24,2020-04-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=946 adultscore=0 mlxscore=0 spamscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004260070 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An IIO device will have multiple buffers, but it shouldn't be allowed that an IIO buffer should belong to more than 1 IIO device. Once things get moved more from IIO device to the IIO buffer, and an IIO device will be able to have more than 1 buffer attached, there will be a need for a back-ref to the IIO device [from the IIO buffer]. This change adds that. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 2 ++ include/linux/iio/buffer_impl.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index eae39eaf49af..bc5050191f51 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1477,5 +1477,7 @@ void iio_device_attach_buffer(struct iio_dev *indio_dev, struct iio_buffer *buffer) { indio_dev->buffer = iio_buffer_get(buffer); + + indio_dev->buffer->indio_dev = indio_dev; } EXPORT_SYMBOL_GPL(iio_device_attach_buffer); diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h index a63dc07b7350..67d73d465e02 100644 --- a/include/linux/iio/buffer_impl.h +++ b/include/linux/iio/buffer_impl.h @@ -69,6 +69,9 @@ struct iio_buffer_access_funcs { * those writing new buffer implementations. */ struct iio_buffer { + /** @indio_dev: IIO device to which this buffer belongs to. */ + struct iio_dev *indio_dev; + /** @length: Number of datums in buffer. */ unsigned int length; -- 2.17.1