Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp204565ybz; Thu, 23 Apr 2020 22:01:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKCAbTjtgpjM+xbjxRs3YHRQudVMW5Gzy5yE/lo5UK4E0VtC7MgekC77QJSerH7WZZ91C06 X-Received: by 2002:aa7:d0c2:: with SMTP id u2mr6001286edo.78.1587704494750; Thu, 23 Apr 2020 22:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587704494; cv=none; d=google.com; s=arc-20160816; b=TlZua8u8Jq+1jpI5bEpAuQ20VeNMqWfN7c+2Om5HzXRa/I8vwUSgfAlyU4Sa/QmiNH kzoNohV6KZ2Q1/BzgGtDR36N7bseJyYBj2QY1fWYLLYF4nYAo4rS70wPeIHZmXk9kOk/ MGIcFr6klrENqoIMoTgt+iBAyziScYnhfotzwSF015rCsPKlgt7o6c73iMWC/XKXegUn ffUB3cC5qe0Ui8fiVsvn7Lc3YKC6eADmSPvjKzgA2EF6bw2A2ODGXS0UMvhpH2GNww4T 5LD4CN2/tUJQCvuGwD/3GGGj4SPKW/jcKmcBsZEqEa80yS/bQaG+3vWtxFG4QDb0LF14 9+Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=T45dyMC+RSg8b8WfNsfTF7doVzk1Q1X7QsvGvNiI1eQ=; b=mflp1uQ0GLjJ4P1PdXddTFpEsTrqxFbCzZMiZ3g21CgG61q7hsdlSuXiWD9aWPhMeR ljsdX4tfeJRVbyRU3BxHYgkRiVZdrWBVPAA4E+ZntwTunolA73OsTjD2nXBwD59OI7Zh 9e8jJaIWoZcYiOLmFVdiZTqnINJX68iVcHZUQBirlMbF17MYMuv9a7LFWAi2p+d5Uyh7 g3f1bzUaW3jZca4o8JI16v+4KolNmUhZkNyYRKcTAQAn+hUMb4gwA+ovO9FrsjaMsNCb Grso76wiF6+0+SGZjqt3LMD5VaN+uOSOG+m8zA5R1c3KLWlrN0UYRo1NoFQcknNdnp+m 4Rvw== 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 d16si2215798eds.428.2020.04.23.22.01.08; Thu, 23 Apr 2020 22:01: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 S1726401AbgDXE4k (ORCPT + 99 others); Fri, 24 Apr 2020 00:56:40 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:38280 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725852AbgDXE4k (ORCPT ); Fri, 24 Apr 2020 00:56:40 -0400 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03O4rGIZ028901; Fri, 24 Apr 2020 00:56:22 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com with ESMTP id 30fxf6csfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Apr 2020 00:56:22 -0400 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 03O4uLEU016508 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Fri, 24 Apr 2020 00:56:21 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 24 Apr 2020 00:56:20 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 24 Apr 2020 00:56:20 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Fri, 24 Apr 2020 00:56:20 -0400 Received: from localhost.localdomain ([10.48.65.12]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 03O4uGpj017534; Fri, 24 Apr 2020 00:56:17 -0400 From: Alexandru Ardelean To: , CC: , , , "Alexandru Ardelean" Subject: [PATCH v4 0/7] iio: core,buffer: re-organize chardev creation Date: Fri, 24 Apr 2020 07:56:35 +0300 Message-ID: <20200424045642.4903-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 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-24_01:2020-04-23,2020-04-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 suspectscore=2 bulkscore=0 impostorscore=0 mlxlogscore=939 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004240035 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The main intent is to be able to add more chardevs per IIO device, one for each buffer. To get there, some rework is needed. Since v3, some changes have been done. See changelog Changelog v3 -> v4: - added patch [1] 'iio: Use an early return in iio_device_alloc to simplify code.' it's main purpose is so that this patch applies: [2]'iio: core: add simple centralized mechanism for ioctl() handlers' depending on the final version of patch [1], patch [2] needs some minor fixup - added patch 'iio: core,buffer: wrap iio_buffer_put() call into iio_buffers_put()' - patch 'iio: core: register buffer fileops only if buffer present' is now: 'iio: core: register chardev only if needed' - dropped 'iio: buffer: move sysfs alloc/free in industrialio-buffer.c' it's likely we won't be doing this patch anymore - patches: 'iio: buffer: move iio buffer chrdev in industrialio-buffer.c' 'iio: event: move event-only chardev in industrialio-event.c' have been merged into 'iio: buffer,event: duplicate chardev creation for buffers & events' since now, the logic is a bit different, and 'indio_dev->chrdev' is now a reference to either the buffer's chrdev & or the events-only chrdev - added simple mechanism to register ioctl() handlers for IIO device which is currently used only by events mechanism Changelog v2 -> v3: * removed double init in 'iio: event: move event-only chardev in industrialio-event.c' Changelog v1 -> v2: * re-reviewed some exit-paths and cleanup some potential leaks on those exit paths: - for 'iio: buffer: move iio buffer chrdev in industrialio-buffer.c' add iio_device_buffers_put() helper and calling iio_buffers_uninit() on device un-regsiter - for 'move sysfs alloc/free in industrialio-buffer.c' call 'iio_buffer_free_sysfs_and_mask()' on exit path if cdev_device_add() fails - for 'move event-only chardev in industrialio-event.c' check if event_interface is NULL in iio_device_unregister_event_chrdev() Alexandru Ardelean (6): iio: buffer: add back-ref from iio_buffer to iio_dev iio: core,buffer: wrap iio_buffer_put() call into iio_buffers_put() iio: core: register chardev only if needed iio: buffer,event: duplicate chardev creation for buffers & events iio: core: add simple centralized mechanism for ioctl() handlers iio: core: use new common ioctl() mechanism Jonathan Cameron (1): iio: Use an early return in iio_device_alloc to simplify code. drivers/iio/iio_core.h | 29 ++++-- drivers/iio/industrialio-buffer.c | 102 ++++++++++++++++++-- drivers/iio/industrialio-core.c | 151 ++++++++++++------------------ drivers/iio/industrialio-event.c | 100 +++++++++++++++++++- include/linux/iio/buffer_impl.h | 10 ++ include/linux/iio/iio.h | 8 +- 6 files changed, 290 insertions(+), 110 deletions(-) -- 2.17.1