From patchwork Fri Apr 5 08:42:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 10887027 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 3727B17E9 for ; Fri, 5 Apr 2019 08:41:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2334B28AA1 for ; Fri, 5 Apr 2019 08:41:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17CBE28B04; Fri, 5 Apr 2019 08:41:48 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CC31028AA1 for ; Fri, 5 Apr 2019 08:41:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5C6C6E1BB; Fri, 5 Apr 2019 08:41:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id B95036E13B; Fri, 5 Apr 2019 08:41:33 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 01:41:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,310,1549958400"; d="scan'208";a="146806985" Received: from ram-dut.iind.intel.com ([10.223.34.157]) by FMSMGA003.fm.intel.com with ESMTP; 05 Apr 2019 01:41:31 -0700 From: Ramalingam C To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, daniel@ffwll.ch Subject: [PATCH v4 05/13] drivers: create binary sysfs for class Date: Fri, 5 Apr 2019 14:12:54 +0530 Message-Id: <20190405084302.5548-6-ramalingam.c@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190405084302.5548-1-ramalingam.c@intel.com> References: <20190405084302.5548-1-ramalingam.c@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , gwan-gyeong.mun@intel.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Functions to create and remove the binary sysfs for class are added. These are getting introduced as DRM wants to create the common binary sysfs across the drm subsystem to handle hdcp srm. Signed-off-by: Ramalingam C cc: Greg Kroah-Hartman cc: Daniel Vetter --- drivers/base/class.c | 19 +++++++++++++++++++ include/linux/device.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/drivers/base/class.c b/drivers/base/class.c index d8a6a5864c2e..b0f37de16a14 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -83,6 +83,23 @@ static struct kobj_type class_ktype = { /* Hotplug events for classes go to the class subsys */ static struct kset *class_kset; +int class_create_bin_file(struct class *cls, const struct bin_attribute *attr) +{ + int error; + + if (cls) + error = sysfs_create_bin_file(&cls->p->subsys.kobj, attr); + else + error = -EINVAL; + return error; +} + +void class_remove_bin_file(struct class *cls, const struct bin_attribute *attr) +{ + if (cls) + sysfs_remove_bin_file(&cls->p->subsys.kobj, attr); +} + int class_create_file_ns(struct class *cls, const struct class_attribute *attr, const void *ns) @@ -577,6 +594,8 @@ int __init classes_init(void) return 0; } +EXPORT_SYMBOL_GPL(class_create_bin_file); +EXPORT_SYMBOL_GPL(class_remove_bin_file); EXPORT_SYMBOL_GPL(class_create_file_ns); EXPORT_SYMBOL_GPL(class_remove_file_ns); EXPORT_SYMBOL_GPL(class_unregister); diff --git a/include/linux/device.h b/include/linux/device.h index b6c6a4634801..004c8064a78a 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -485,6 +485,10 @@ struct class_attribute { #define CLASS_ATTR_WO(_name) \ struct class_attribute class_attr_##_name = __ATTR_WO(_name) +extern int __must_check class_create_bin_file(struct class *class, + const struct bin_attribute *attr); +extern void class_remove_bin_file(struct class *class, + const struct bin_attribute *attr); extern int __must_check class_create_file_ns(struct class *class, const struct class_attribute *attr, const void *ns);