Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp622211pxy; Thu, 22 Apr 2021 09:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys9QeDuI1yMdzCx7HCHYKIGYWoX/nhwvQN1CFtAcwQSCArNo7b19Ngxrl323SPVnZWJRrq X-Received: by 2002:a63:1f02:: with SMTP id f2mr4351690pgf.195.1619109205854; Thu, 22 Apr 2021 09:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619109205; cv=none; d=google.com; s=arc-20160816; b=dvE8qvgE/UkgnS6yOqsW7m2l5TTqkGWpoSbi9uPtjiAoQCfjxYSsH7LzgXIDAONADc P89hc35d/tVqW6TWNxWpf5jlmYEpQVB6fM+0DB6592kZuDzGwA8tGZKEIYsNucXnFp1V i7RI+w/edE5QyAF31OhwkT7SMqylNGr8ggdPGFte3Z0yAZ42ZionEOVDj87szFTVGS0L S1Ltjr9UgCEeMKD1duZVidtlAr14VH6JKCTOkJz6VTNynIUtqwOdJYcjq8McVB4nCPxu 2Aip5qPwjvDa/N3LO/dsfrIJwCm+sY9r3mSxIpYRE3o4ktausqJaYO5vmUkElI+4MQfk Fyhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cozMNl4x0aoDfS151vd4k3rQFwhI4XY6oBVsQT9uHNQ=; b=SbW3lb06zwKkAeJvokuWJ0YZgVQgX52ZGc2cyeqR2oDelaHCQNhjBvLAEI9+dL382e lrSCucJAPg5mxrWTaR9Ot0LiaUQNAwZrNeL20RBF0Du4RkdXdcEC4MF4qKDEKJ+gM+cV xYtOkJ8ARFstvRsyKnDDFqhQURm+ui5TD5wzdCYDKtvwv4fB+fcQubcruymVBEAoPeM6 Ccx9lyQFN1HD42UgJRmben2WO+pGzBKJ7EUWaXixUCXqY9QZJ+sE2MGegW5QmK0fZwSm 0hEhsWI6oo0VgNt+e4jRdhgNn98t774QHkcGZHjG2/R5BU0S+wru1ak1ZJIiH9rY77NG v1jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nn248Tti; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si4496755pfz.153.2021.04.22.09.33.13; Thu, 22 Apr 2021 09:33:25 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Nn248Tti; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236603AbhDVQcz (ORCPT + 99 others); Thu, 22 Apr 2021 12:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236662AbhDVQcz (ORCPT ); Thu, 22 Apr 2021 12:32:55 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380C2C06174A for ; Thu, 22 Apr 2021 09:32:20 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id s20so7968855plr.13 for ; Thu, 22 Apr 2021 09:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cozMNl4x0aoDfS151vd4k3rQFwhI4XY6oBVsQT9uHNQ=; b=Nn248TtiVAoPlwvqR27j4chs/hwfU/A16DV50RupiPpu/t46mpFxp07L1eIAVXAFq0 8+rmYuoevJMFuOBc5+rZWv1sO8jgLjU+X9MnOuov5H40vc9O1B4o4OBAn8eCt2znBw1K zsk7pAdtxtX03L2SPZyca9kC6Z3QehisnxckskRcBVm8N0f74qMvAe4uQY98nltmGMzk CLovQr/wxoJiiiNJFkqzQg8weB/t6DHb50ktkSUh/aCPxYY1OK1TdwASNC473IReV9IP svTny4CV8QwOCqW6DpLkWfXrj+SBEtz1CB5pqT4zH/CCAPWS+dp3L4fNyC3i3UOulnK8 qszA== 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:references :mime-version:content-disposition:in-reply-to; bh=cozMNl4x0aoDfS151vd4k3rQFwhI4XY6oBVsQT9uHNQ=; b=R9cAKJQL3aGpKiOH2bV2DDKNrH8qucnQbaGNADSIj1DliHz9rpbWmkccFDkUTNcLTN VyPjm6dW8VifouhHYuT3oilnmez7Fv9e0+8Y7RQuPMJ3s6C2tjCDV0aWEryBT+Kg+SOb PMuHIOb8ISr4V1hrCVo7RVVSOZOp3xoXDLFqXvA1uqAvbUiqg5UsVH+fSMp7ezdvNTy8 SxkTY7NG28Hguc9vERP6Ha/jEIPanSdOBMA7zUk6kpYTz0P8f/YP/clY0vdwij8Ty8BM ppKSQ0HC9tBUqrljAGy10igWbIjXMX4+TmCVfscpreYfkcJsjW/KSdkpHiGTPxtzpmJX 4s7A== X-Gm-Message-State: AOAM530i/i8sEa+z4YFzGT+YwO5I4qhWDBqPLIQQsW7PuDTAA1w1ZGwn OuLuqy+9M95uXVhywNalkF+m03Vf2TBUXg== X-Received: by 2002:a17:90a:a78c:: with SMTP id f12mr873180pjq.219.1619109139744; Thu, 22 Apr 2021 09:32:19 -0700 (PDT) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id z188sm2717992pgb.89.2021.04.22.09.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 09:32:19 -0700 (PDT) Date: Thu, 22 Apr 2021 10:32:17 -0600 From: Mathieu Poirier To: Arnaud POULIQUEN Cc: Bjorn Andersson , Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v2 2/7] rpmsg: Move the rpmsg control device from rpmsg_char to rpmsg_ctrl Message-ID: <20210422163217.GB1256950@xps15> References: <20210413134458.17912-1-arnaud.pouliquen@foss.st.com> <20210413134458.17912-3-arnaud.pouliquen@foss.st.com> <20210421180455.GE1223348@xps15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 22, 2021 at 09:56:41AM +0200, Arnaud POULIQUEN wrote: > > > On 4/21/21 8:04 PM, Mathieu Poirier wrote: > > On Tue, Apr 13, 2021 at 03:44:53PM +0200, Arnaud Pouliquen wrote: > >> Create the rpmsg_ctrl.c module and move the code related to the > >> rpmsg_ctrldev device in this new module. > >> > >> Add the dependency between rpmsg_char and rpmsg_ctrl in the > >> kconfig file. > >> > >> Signed-off-by: Arnaud Pouliquen > >> --- > >> update from v1: > >> - keep "rpmsg_chrdev" driver name in rpmsg_ctrl, driver will be renamed > >> in next path that renames the rpmsg_chrdev_create_eptdev. > >> - rename the chardev regions > >> - move RPMSG_DEV_MAX to rpmsg_char.h > >> --- > >> drivers/rpmsg/Kconfig | 9 ++ > >> drivers/rpmsg/Makefile | 1 + > >> drivers/rpmsg/rpmsg_char.c | 181 +---------------------------- > >> drivers/rpmsg/rpmsg_char.h | 2 + > >> drivers/rpmsg/rpmsg_ctrl.c | 231 +++++++++++++++++++++++++++++++++++++ > >> 5 files changed, 245 insertions(+), 179 deletions(-) > >> create mode 100644 drivers/rpmsg/rpmsg_ctrl.c > >> > >> diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig > >> index 0b4407abdf13..d822ec9ec692 100644 > >> --- a/drivers/rpmsg/Kconfig > > snip[...] > > >> +static int rpmsg_ctrldev_init(void) > >> +{ > >> + int ret; > >> + > >> + ret = alloc_chrdev_region(&rpmsg_major, 0, RPMSG_DEV_MAX, "rpmsg_ctrl"); > >> + if (ret < 0) { > >> + pr_err("rpmsg: failed to allocate char dev region\n"); > >> + return ret; > >> + } > >> + > >> + rpmsg_class = class_create(THIS_MODULE, "rpmsg"); > > > > This class thing really bothers me. Keeping this here means that rpmsg_eptdevs > > created from user space will be associated to this rpmsg_class but those created > > from the name service won't. As such I propose to move this to rpmsg_char and > > simply not associate the control device to the class. > > > > Otherwise we'd have to introduce some mechanic only to deal with the creation of > > the class and I don't think it is worth. We can revise that approach if someone > > complains we broke their user space. > > I agree with that as it was my first proposed approach here [1] Yeah, sorry about that. This patch review process is not an exact science... > > [1] https://www.spinics.net/lists/linux-arm-msm/msg81194.html > > Thanks, > Arnaud > > > > > > >> + if (IS_ERR(rpmsg_class)) { > >> + pr_err("failed to create rpmsg class\n"); > >> + ret = PTR_ERR(rpmsg_class); > >> + goto free_region; > >> + } > >> + > >> + ret = register_rpmsg_driver(&rpmsg_ctrldev_driver); > >> + if (ret < 0) { > >> + pr_err("rpmsg ctrl: failed to register rpmsg driver\n"); > >> + goto free_class; > >> + } > >> + > >> + return 0; > >> + > >> +free_class: > >> + class_destroy(rpmsg_class); > >> +free_region: > >> + unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); > >> + > >> + return ret; > >> +} > >> +postcore_initcall(rpmsg_ctrldev_init); > >> + > >> +static void rpmsg_ctrldev_exit(void) > >> +{ > >> + unregister_rpmsg_driver(&rpmsg_ctrldev_driver); > >> + class_destroy(rpmsg_class); > >> + unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); > >> +} > >> +module_exit(rpmsg_ctrldev_exit); > >> + > >> +MODULE_DESCRIPTION("rpmsg control interface"); > >> +MODULE_ALIAS("rpmsg:" KBUILD_MODNAME); > >> +MODULE_LICENSE("GPL v2"); > >> -- > >> 2.17.1 > >>