Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp80032ybj; Fri, 8 May 2020 07:00:12 -0700 (PDT) X-Google-Smtp-Source: APiQypIjIxFd099AW1FgJRwzcEyF/yPteVHv/qht5HowIv7QZn0VUiLTOpEd2CkN+AqXJ7TwrXjS X-Received: by 2002:a1c:80c3:: with SMTP id b186mr17665494wmd.117.1588946412002; Fri, 08 May 2020 07:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588946411; cv=none; d=google.com; s=arc-20160816; b=F3vngIHOjzPITTRT/uVcbXLwZzIky9xddJUxfb1VfRtZbMq/ENuyeCGimLHmOH0vd5 3ggq+04orEcu3zf02ypmi8mdY+v1R8SQdpJZbwNpzaJXCC7axgp/Tjd5AJ1UTfiTWb4n m1nsQ+4OZhE7Pi+MQGVdfSYya1KCgKHZykhfwXDOwuvNSBMy4eQsql9OmpGFNKXOa+tv ElhdW6KZ0H4wBaGIEBlTg7WZ+dS8asi8JM74RcSdRaC0IeudIj/fosmdJSXtoWj1F0Kt dcZuywUb5RsZ5Yw0CyoO+k/Hl4trYOyoD1lr5kyt7BtxJrc+Y3HetLdSTj9hu8ouV+gO LkQQ== 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=TDH8GmmDtz9eh+eG3ziYZO/mjMCPzZEG5rPQB/EHR+U=; b=Rpp04zXmyOpCz9A1xlGt8ogqyEZ6dSq9GhXQpPERgAwC8qZMem+J4/jHUQEL3t2pmX 97vkerDP2dt9KcvjF/Ukun82VscnVEs4475OAULdabhn7YQddVFUV8TSfrplw/TnKXZd sRtt9ps9LHPIS+clB2/3ShnJQL4i7NaMsfySpeceGlmSRhkEboKxsPKhQ9yCXK6KdZQE tUnszNzJ3wOyFDnfhEqTulAqFUldx529nYLP2jEc1uaUNXPcLvOZLAjugXflpLkGyAP8 opakBir0wirBvik8eFJC2hFW4JCuoYvTR3VhBSDYjORR/fue39PM5iYpeceW/8uoOds/ zhbg== 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 j3si996770ejb.294.2020.05.08.06.59.47; Fri, 08 May 2020 07:00:11 -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 S1728685AbgEHNzK (ORCPT + 99 others); Fri, 8 May 2020 09:55:10 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:42488 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726904AbgEHNyO (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 048Diipc006142; Fri, 8 May 2020 09:54:01 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 30vtef2j5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 May 2020 09:54:01 -0400 Received: from ASHBMBX8.ad.analog.com (ashbmbx8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 048Ds0eC038773 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Fri, 8 May 2020 09:54:00 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.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 09:53:58 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Fri, 8 May 2020 09:53:58 -0400 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 048Drpwn030263; Fri, 8 May 2020 09:53:55 -0400 From: Alexandru Ardelean To: , CC: , , Alexandru Ardelean Subject: [RFC PATCH 03/14] iio: buffer: add back-ref from iio_buffer to iio_dev Date: Fri, 8 May 2020 16:53:37 +0300 Message-ID: <20200508135348.15229-4-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=0 clxscore=1015 phishscore=0 mlxlogscore=942 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 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 7eed97c1df14..3b1071deba00 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1493,5 +1493,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