From patchwork Mon Jun 14 19:32:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ojaswin Mujoo X-Patchwork-Id: 12319685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEA24C2B9F4 for ; Mon, 14 Jun 2021 19:34:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82F6361153 for ; Mon, 14 Jun 2021 19:34:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82F6361153 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8X6STAwl+LtXGmsGvW21BRcEVOBsF3M1JRJyKSexUOg=; b=V3L8bTnAnayB3x WcZwklYMwwktc+972J0eKcy5F5JBR0TexEnBwgYDbBskLAlpeUB0vN4JtJGqpS48lKQTwJLuo1+ze KUsThT7SFo1PNv+YtXHZTZ+yZKg9Y7DL0AW/4QzNYrwxGQxBObPvj44AyJWoxssvmZYTvNRSjtvVD xUDDVA2h7dvG8HNxn3J/9ONnD7eyEnjy5e0auJgeQFcwLy/GEjuk0tpZ34SyMn0OoyJexh6M9Zi39 RvnvwVF5KSzUejkj0W7lWPkjIgIVJ9Mv7scG+3aE5Qlm6X03z4fE1c23fws6ndedhhRdReaGQ9T++ 6RtxnfGO0rZxUSREtrZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lssKH-00Fsrl-Rb; Mon, 14 Jun 2021 19:32:50 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lssKE-00FsqY-Od for linux-arm-kernel@lists.infradead.org; Mon, 14 Jun 2021 19:32:48 +0000 Received: by mail-pl1-x629.google.com with SMTP id b12so7140626plg.11 for ; Mon, 14 Jun 2021 12:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=/OPxWaLtvVu/z2v/4XfNWK9orPebrYZ20oJOegdJeGo=; b=AQmzMqMQWD8J/LlROBnDEwQcTpJJIW7ZtrUMLI2Jjc0U2C6qfUT0qULgPeb3CfktIi WNCkEQ38R7rQItUU9rbXFJry6p1M5Oq/d6sn1Hzp72tGFCqJqB99bHi8Zr0f2V0K/7GO Dc8+WyKg9TXDm+ndq5FRtjzZafAg6a5dK/x6rWJ72msXGQiUhcPpCZyzdjI25s02ADXM VvnDxc6jhgzfl5d7DuiH7jF9PrInTRP1lUbToOAqSuvo83aeVek7dXssKSL0PKS/9NHz aL7ooxSpaeNMGTq/rg1ghbAJh2z+maca7pY7oU2WvYh0iDFwJOt5D9xeA7COzAclg+P+ gfDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=/OPxWaLtvVu/z2v/4XfNWK9orPebrYZ20oJOegdJeGo=; b=ogLgou0ac0xUmyc/M5BFrqcvT2Rtm4ujO4cFmbc6/VfdaiuqmV0HUjX4C0wIP7iHuH lRzO8tVFIHMn6ST6BduHEZyFjt7/tCH4oDb3mVHeT8seRup7sC2w96yGI2fLrDDj+aus XhmHqI3VN4QPGqpIahOMyO4e1xPIesAm7GGhmGsGvhFWawwYW2J82sRT87ignWalApFk IDxoCIpjZJP5y6D5mRl0dEBIj52ixla6R64Cs1ZsnQT9NgY4R5uXzRdI34a+YEVhQtXg SWsoucoZcjsuMKREy6GkRAhud0+SHQpxQAJFdGi6LHz3z96RI9PzKuEnueuVSm5nSZFW +88g== X-Gm-Message-State: AOAM532bgcFjbWxOXqnpqJHEQLVoqtRKli+s4qIw7GTP3TEFS9KzFHbu TXwJDC8+w0E+Ln01XLbL6yuRmUo70K4= X-Google-Smtp-Source: ABdhPJz08bEuyuWwwwWae+Il5Y8vEh64X4IreInp90IwXE8spwySeGxwFrQWPGzPFvToKno28FoWmw== X-Received: by 2002:a17:902:c789:b029:110:4933:71ce with SMTP id w9-20020a170902c789b0290110493371cemr404007pla.56.1623699163964; Mon, 14 Jun 2021 12:32:43 -0700 (PDT) Received: from ojas ([122.177.234.250]) by smtp.gmail.com with ESMTPSA id k21sm13444961pgb.56.2021.06.14.12.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 12:32:43 -0700 (PDT) Date: Tue, 15 Jun 2021 01:02:32 +0530 From: Ojaswin Mujoo To: nsaenz@kernel.org Cc: gregkh@linuxfoundation.org, dan.carpenter@oracle.com, phil@raspberrypi.com, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 0/1] Request to review progress decoupling vchiq platform code Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210614_123246_834027_1280A99D X-CRM114-Status: GOOD ( 30.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Greetings, I'm working on addressing item 10 of the following TODO list: drivers/staging/vc04-services/interface/TODO For reference, the task is: 10) Reorganize file structure: Move char driver to it's own file and join both platform files The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process. This patch is the first step towards decoupling the platform and the cdev code. It moves all the cdev related code from vchiq_arm.c to vchiq_dev.c. However, for now, I have aimed to keep the functionality untouched, hence the platform code still calls the cdev initialisation function, and isn't truly decoupled yet. The summary of the changes is as follows: * Definition of functions and variables shared by cdev and platform code are moved to vchiq_arm.h while declaration stays in vchiq_arm.c * Declaration and definition of functions and variables only used by cdev code are moved to vchiq_dev.c file. * Defined vchiq_deregister_chrdev() and vchiq_register_chrdev(..) in vchiq_dev.c which handle cdev creation and deletion. They are called by the platfrom code during probe(). I mainly wanted to put this patch out to see if I have the right idea of the task at hand and to ensure I'm heading into the right direction. I would love to hear your thoughts and suggestions on this. Once I have some feedback on this, I can accordingly work towards a newer version to completely decouple the code. Lastly, I had some questions related to the the task: 1. So regarding the following line in the TODO: "For instance to be able to use bcm2835-audio without having /dev/vchiq created." I was wondering about the possible ways to achieve this. Specifically, I was thinking of the following 2 ways: 1.1 Making a KConfig entry for Cdev creation, like CONFIG_VCHIQ_CDEV, and then do something like: vchiq_probe(..) { /* platform init code */ #if defined(CONFIG_VCHIQ_CDEV) /* Call cdev register function */ #endif } 1.2 The second approach is creating an entirely separate module for the cdev, as suggested in the TODO. So I'm just wondering what the right approach should be? 2. Second, I currently tested by installing my patches to a pi3 B+ and running `cat /dev/vchiq` to compare the output with the original kernel. Also, to see if the platform code works without the cdev code, I commented out the call to vchiq_register_cdev() and made sure the platform device (and children) was registered but the char device was not present. However, I'm not sure if these tests are comprehensive enough. What would be the right way to test my changes? 3. Lastly, I think the git diff is acting up a bit because of the code rearrangement. I tried to check online if this is normal or if I messed it up somehow, but couldn't find much. Can someone please confirm this? Thank you in advance for looking into this and for helping me out upto this point! Regards, Ojaswin Ojaswin Mujoo (1): staging: vchiq: Move vchiq char driver to its own file drivers/staging/vc04_services/Makefile | 1 + .../interface/vchiq_arm/vchiq_arm.c | 1885 ++--------------- .../interface/vchiq_arm/vchiq_arm.h | 73 + .../interface/vchiq_arm/vchiq_dev.c | 1488 +++++++++++++ 4 files changed, 1770 insertions(+), 1677 deletions(-) create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c