From patchwork Fri Jun 2 10:05:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gottfried Haider X-Patchwork-Id: 9762081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 12E4360360 for ; Fri, 2 Jun 2017 10:06:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07E2528521 for ; Fri, 2 Jun 2017 10:06:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEB3A28565; Fri, 2 Jun 2017 10:05:59 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5003828553 for ; Fri, 2 Jun 2017 10:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From: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=cG83IGnsxYV39Ztu7el9L0ctO/U4PPFqn0DPf2GMepU=; b=aVT ClnW1cJaE7jIfusEREleraWMVNUo9bT8o7c7ZYgC0GemnvKJbFGFue8jCxslKpNHu32dysETS9VaN R5h/r8Dj+A2qkWQH2Sa6hidHnEFw6hlwOnJyaFJ/yfwnAP5qkBWMceKle2keJ+i21Sxc2++wauhVX NVAnJHs80wbxQ2qg7nXxNc1NOpc4Pt7xj8r4XueaFxYgBsSo/leIpFQ86S3Pmiau7BY4N68+DQtra Kc/Yu++PocQceUVXXgEXYGhSelA4K03uEgnxB7jg9IVtYSEYggd+V7PYn7DhaMoOogjsskxRaqiUl sYlwwZUwdvptQp9Q9bbihUHx+EaJKpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dGjSv-0004nD-Va; Fri, 02 Jun 2017 10:05:57 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dGjSs-0004l7-77; Fri, 02 Jun 2017 10:05:55 +0000 Received: by mail-wm0-x242.google.com with SMTP id k15so17799687wmh.3; Fri, 02 Jun 2017 03:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4AkDmQOgfrLsykNnbzDgdCYo01/jNehEG3p7zdhdXJQ=; b=LchW6lk2kzLjZohfZvnsW2j6ODvS+vGs3yypTwymrvuo852TWok0KmN6+dIr715S+7 lDu4KymvHlEuVt1OG4Zyga/iC3W12T0LqERyoyngdhEdceDfDeiiqzdVJrgbOxkWYIQR rG08TS9lkkl3E1cNtq0rw5p9gAY2hm53bSXufAWEeEQD+Auz7Oiw2jPbK0i5W6AUsq11 rlI0v37Czet+r8BeDW2rBQ7HqenRIjK16qLN8F9T7BClcjfN1AfESVWRuK3TseBhFBMq VtbwKgeR0B0nHJv/E3qjsFfSLzadYbOJ44fC3cClyoVSsbm8pYpu4xYFCfgiiKwdJ/0z gyVw== 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; bh=4AkDmQOgfrLsykNnbzDgdCYo01/jNehEG3p7zdhdXJQ=; b=D9rUouVSSG0mCOG5A/o8J1OSJ0ve00nueGDvYvYke4w4IwFKiPbWcE2+y4qnFrGDwT mwvUfxhWUhe4IFOAZaL4qnU0RlgLpkARQiZ6GeEWxzWLTuDAN7MzilzkKEToVHYd6Z2v xBN7XDIPjhTR/lh230Ud93UeBg4x2m10eV+UYxgxBpH4zu6AbI2qjQJjdhmJally8ZRy oBanYEqXhmjm8O53+InMQJOBMBVK7wQaoWoAMzA4C1KNts8y7qthHL15Kt3Ak359hYsC jMWr2uNy2FczN2zHPqFS+BXYO8IxQ9nffR+byRhjgi9vFwEq1LiKhBuvHMjr0BV6NKeJ TwNw== X-Gm-Message-State: AODbwcB2l96trJyzl5QAAJVUaC8+OowGl0FL65ar6x8VOT3fOk93VaAj PUB703DABBNnIg== X-Received: by 10.223.151.210 with SMTP id t18mr5298119wrb.18.1496397932171; Fri, 02 Jun 2017 03:05:32 -0700 (PDT) Received: from localhost.localdomain ([62.178.189.236]) by smtp.gmail.com with ESMTPSA id y6sm26744940wrc.51.2017.06.02.03.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Jun 2017 03:05:30 -0700 (PDT) From: Gottfried Haider To: Gottfried Haider , Thierry Reding Subject: [RESEND][PATCH] pwm: Set class for exported channels in sysfs Date: Fri, 2 Jun 2017 10:05:21 +0000 Message-Id: <1496397921-1713-1-git-send-email-gottfried.haider@gmail.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170602_030554_417540_DE1B0C68 X-CRM114-Status: UNSURE ( 8.69 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: H Hartley Sweeten , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Notifications for devices without bus or class set get dropped by dev_uevent_filter. Adding the class to the exported child matches what the gpio subsystem is doing. With this change exporting a channel triggers a udev event, which gives userspace a chance to fixup permissions and makes it possible for non-root users to make use of the pwm subsystem. Signed-off-by: Gottfried Haider CC: Thierry Reding CC: H Hartley Sweeten CC: linux-pwm@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org CC: linux-rpi-kernel@lists.infradead.org --- drivers/pwm/sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index a813239..83f2b0b 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c @@ -263,6 +263,7 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm) export->pwm = pwm; mutex_init(&export->lock); + export->child.class = parent->class; export->child.release = pwm_export_release; export->child.parent = parent; export->child.devt = MKDEV(0, 0);