From patchwork Mon May 1 06:59:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gottfried Haider X-Patchwork-Id: 756995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wGb0j2Rq9z9s8V for ; Mon, 1 May 2017 17:00:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Nhug8Z9g"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S642773AbdEAHAg (ORCPT ); Mon, 1 May 2017 03:00:36 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35736 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S642757AbdEAHAf (ORCPT ); Mon, 1 May 2017 03:00:35 -0400 Received: by mail-wr0-f195.google.com with SMTP id g12so13091600wrg.2 for ; Mon, 01 May 2017 00:00:34 -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=acuFyYiDE3KUfvSb6KlHs4eQ9LB2LT6Ze/ZdXC3V+1I=; b=Nhug8Z9g6JzvwRSQdntesgTVeU9QBOa2E1TLVj7xHgMb1sda6TjZDWLZtVaJMr8I/1 RX36qpNP9gmvVWRaJy2GrJ5Ov8TIpqqjHc1riyetbu18jsMzSEHPIhx7UaGoEe18oE0P 5Wv2CJi3VK8/orpbQzzPojBngXgt380f4oZ8Ta8JyTZprTjajPq7EJ9AEzk9uqUqX0kX SjtelhtWPnOEsz1PKYT32BPrEyxMzVzyZrU55SOy15M/znU6lXD4WlRNOgDKf27ws+W+ x2SXO7mTjFXE2aMnfAyNIu5iqhUPLEc2ED63aaN/jcJkjKOS7OBj7YBGcRRr6spe/uw7 VLoQ== 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=acuFyYiDE3KUfvSb6KlHs4eQ9LB2LT6Ze/ZdXC3V+1I=; b=FQGyqBlP7hx5DVayTXv3W6pXHWULb8nyDPDqZQHsl3RrKW0QxJbjpp2BCfHzbiON1R 5fdYVKFr+R1TYy8++8d7tY2zkFhwbey+Ez5Z/1iy8XCliAN//f98flgzGQglYiqS3Rl5 fI+rGWsGwPOJlhU2DIPy+VHXAvVfRWA8inqI1WIG10AJ+R/hTyycdJ9d53ydhQnOSisc jx4itb+W4jFFIcGke0QF7+PMGfyrtXmeIpUYvh2Xk6wN4QGCJEQuxRp5AkfPBzYFatuh tiKJtBwnSaXY3cTzXTrNOhP7lqIpDg1Vm1fAb/z2/JC8+qkvleBdEWf1KGwslnOnj3zI Doxw== X-Gm-Message-State: AN3rC/5912oh9X11cW471GD9wlMpMo5kaVc/2KjOaf3hCveMQcw0oZly G3AnpgDzdcEtWA== X-Received: by 10.223.168.97 with SMTP id l88mr15558162wrc.54.1493622033830; Mon, 01 May 2017 00:00:33 -0700 (PDT) Received: from localhost.localdomain ([62.178.189.236]) by smtp.gmail.com with ESMTPSA id x65sm10469977wmg.3.2017.05.01.00.00.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 May 2017 00:00:32 -0700 (PDT) From: Gottfried Haider To: Gottfried Haider , Thierry Reding Cc: hsweeten@visionengravers.com, linux-pwm@vger.kernel.org Subject: [PATCH] pwm: Set class for exported channels in sysfs Date: Mon, 1 May 2017 06:59:58 +0000 Message-Id: <1493621998-4982-1-git-send-email-gottfried.haider@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org 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 --- 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);