From patchwork Tue Dec 18 00:08:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10734557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30F4714E5 for ; Tue, 18 Dec 2018 00:09:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21B5029BE7 for ; Tue, 18 Dec 2018 00:09:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15FE629BF1; Tue, 18 Dec 2018 00:09:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6AC829BE7 for ; Tue, 18 Dec 2018 00:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726538AbeLRAJN (ORCPT ); Mon, 17 Dec 2018 19:09:13 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42612 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbeLRAJE (ORCPT ); Mon, 17 Dec 2018 19:09:04 -0500 Received: by mail-pf1-f196.google.com with SMTP id 64so7168368pfr.9 for ; Mon, 17 Dec 2018 16:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nKA343VWfqT0i6llLCv/qR9rGyeHc6kj4MhGFMqq5pQ=; b=nIkEvDVT0DKbehtvUeKxjag7iF8MH/Lq9uKi66Gmu2QH3j5Wr2QhofqaIJ3zrihtj1 AW8CGeFJELP6CSTObw+J/o3z+tj8DHOuOpB54bUgX4JP/RAmoudFVPiuHqd6ybegLScq ta67mJ4C92Wgn8b+uy/JinVpRJMUS7wxbfc3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nKA343VWfqT0i6llLCv/qR9rGyeHc6kj4MhGFMqq5pQ=; b=SMDCknCrPwqRv54Pu1sDNKMQNjrrh3fM+BGNJaD2S9u61ld20D27r3SBnU8xhYovzI k2woZZrCkiTW8jXnFUpqDTh7a/DaYv28XxJFsvEyFUZrmre3nUIwFkhVPYX6iC0brt3x HaoBVjLDRwuGyVKuNqUlzuvSRgXQgQ4N0PgmNH127TieiPv2Bmef7i2iTTsdKve6+9KP lvJRCzL4uqXnfQYR2hg81aLmFcjU0n9G/6CgL7VApAikBM2jg8Kt8l4FA2pzPBaTNf+i P/UWiKUzx/tbr86q6HMBx3BG1+2qlRBV19Hgi86SmeCQZhkuQGuaIs45TKD8ky5yUVes Xyig== X-Gm-Message-State: AA+aEWa8imgxCppAfMqWvFl1SLGpHaqU5Hsc1FGVNql+oHDcCQDadw2g Tfr3Jvuogdr8omHXrntkQa9q+Q== X-Google-Smtp-Source: AFSGD/V9R2ngeQ/UVOD9iyHh71lEuLWY6Eq71OW1YqMguCSTiKdVXN/ZxQ8HA+sjfWr5mvInAsaH2g== X-Received: by 2002:a62:5716:: with SMTP id l22mr15114407pfb.16.1545091743883; Mon, 17 Dec 2018 16:09:03 -0800 (PST) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:ffda:7716:9afc:1301]) by smtp.gmail.com with ESMTPSA id m65sm21734424pfg.180.2018.12.17.16.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 16:09:03 -0800 (PST) From: Evan Green To: Andy Gross , Bjorn Andersson Cc: Brian Norris , Ben Chan , Evan Green , linux-arm-msm@vger.kernel.org, David Brown , linux-kernel@vger.kernel.org Subject: [PATCH v1 1/2] soc: qcom: rmtfs-mem: Add class to enable uevents Date: Mon, 17 Dec 2018 16:08:33 -0800 Message-Id: <20181218000834.201748-2-evgreen@chromium.org> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181218000834.201748-1-evgreen@chromium.org> References: <20181218000834.201748-1-evgreen@chromium.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the qcom_rmtfs_memN devices are entirely invisible to the udev world. Add a class to the rmtfs device so that uevents fire when the device is added. Signed-off-by: Evan Green --- drivers/soc/qcom/rmtfs_mem.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index 97bb5989aa211..0bf800ee2a978 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -132,6 +132,11 @@ static int qcom_rmtfs_mem_release(struct inode *inode, struct file *filp) return 0; } +static struct class rmtfs_class = { + .owner = THIS_MODULE, + .name = "rmtfs", +}; + static const struct file_operations qcom_rmtfs_mem_fops = { .owner = THIS_MODULE, .open = qcom_rmtfs_mem_open, @@ -173,9 +178,15 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) } + ret = class_register(&rmtfs_class); + if (ret) + return ret; + rmtfs_mem = kzalloc(sizeof(*rmtfs_mem), GFP_KERNEL); - if (!rmtfs_mem) - return -ENOMEM; + if (!rmtfs_mem) { + ret = -ENOMEM; + goto unregister_class; + } rmtfs_mem->addr = rmem->base; rmtfs_mem->client_id = client_id; @@ -199,8 +210,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) dev_set_name(&rmtfs_mem->dev, "qcom_rmtfs_mem%d", client_id); rmtfs_mem->dev.id = client_id; + rmtfs_mem->dev.class = &rmtfs_class; rmtfs_mem->dev.devt = MKDEV(MAJOR(qcom_rmtfs_mem_major), client_id); - ret = cdev_device_add(&rmtfs_mem->cdev, &rmtfs_mem->dev); if (ret) { dev_err(&pdev->dev, "failed to add cdev: %d\n", ret); @@ -235,11 +246,13 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) return 0; + remove_cdev: cdev_device_del(&rmtfs_mem->cdev, &rmtfs_mem->dev); put_device: put_device(&rmtfs_mem->dev); - +unregister_class: + class_unregister(&rmtfs_class); return ret; } @@ -258,7 +271,7 @@ static int qcom_rmtfs_mem_remove(struct platform_device *pdev) cdev_device_del(&rmtfs_mem->cdev, &rmtfs_mem->dev); put_device(&rmtfs_mem->dev); - + class_unregister(&rmtfs_class); return 0; }