From patchwork Wed May 12 14:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12253879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6DE3C43616 for ; Wed, 12 May 2021 14:27:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37ED2613E9 for ; Wed, 12 May 2021 14:27:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37ED2613E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8F786EC11; Wed, 12 May 2021 14:27:27 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2072.outbound.protection.outlook.com [40.107.223.72]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA0B96EC11; Wed, 12 May 2021 14:27:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CmkQr74taIp1Iw7KaANpctHA35hNoUXNDLkt4FDMNor/p4IEBV8X/4bj+V776nqpSAwdyhWi9YhgwmFyQ7D+p2cUwtQ1qRtrdpArR3jo2puWzB7i/YRfaM5nWO44XeZVeEjHltCp2vYqo+T8nBfxdN/mKP9ZBg4z7hoS9wqLhKIJGPI/p6QfAoqKpRxqDEkUS/1bpAbp6uo4ZPsJVtAJEq7W+XwBpolhDZM6og3yaOtOyM6KWeR2hAkARoafHirv7X0lYaYObKr0mIFiI9X6nzRZUFhVu7vkeCMQSWDOkK5qFW2Wk1OIjqkHDy+SKBMf5GXZFebMqkGey/Jck+C2PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ib9JMbJcQ89S3QqH2/zvtmoA13b9zTTfzZEYQOgJxs4=; b=jpzUTj/AYiDtyZ5sUU16lKenuffbZedAu8u+j453UWRIHUN9Dw68Jy9FDuMyGSTBs4ETT/QTZRQ2S6OphfdQ7Ci4ESprgJQY6BBemRIYxvJ+Dkui3NgjN6a+jDyddOvKDDZ1E0VPgA+7P69VXz4IboD0emFfvbEmnPA6lqMe9DlGwRIE+xRNpwGbzXtVSpWKwTYb/qKnLhdPdJ3hAIElmLHItUMLIvaGTvjPafBaM8hhF8MxHk77AmJm89bT2Jc5ZHqE+XDavcxmWCTuAE4QPqZnbcFy97yeIL/eze/JCsHYH08PbDw6SHD5GrS6uGnABcg+sEilaJuCNq9mRgoY9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ib9JMbJcQ89S3QqH2/zvtmoA13b9zTTfzZEYQOgJxs4=; b=dejeCAViCbUGefjdpMBG1HI/5+wnIryalwnu33JMf5cKQBeHCp5SDAPwiOKSP+Su9iltYdIfu3a+yxtww2i4w9h6kj8PlFXLSPZSewSNqZwMXaWT/lnEnRi97De9mKAPOhTkgt5hav3eoXmZd/JV2ixf4PiMXQtVq4sP7PCkg/k= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) by SN6PR12MB2845.namprd12.prod.outlook.com (2603:10b6:805:75::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Wed, 12 May 2021 14:27:24 +0000 Received: from SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c]) by SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c%7]) with mapi id 15.20.4129.026; Wed, 12 May 2021 14:27:24 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-pci@vger.kernel.org, ckoenig.leichtzumerken@gmail.com, daniel.vetter@ffwll.ch, Harry.Wentland@amd.com Subject: [PATCH v7 07/16] PCI: Add support for dev_groups to struct pci_driver Date: Wed, 12 May 2021 10:26:39 -0400 Message-Id: <20210512142648.666476-8-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210512142648.666476-1-andrey.grodzovsky@amd.com> References: <20210512142648.666476-1-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:7576:4f76:97d8:1487] X-ClientProxiedBy: YTOPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::45) To SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from agrodzovsky-All-Series.hitronhub.home (2607:fea8:3edf:49b0:7576:4f76:97d8:1487) by YTOPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.30 via Frontend Transport; Wed, 12 May 2021 14:27:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cc5f59e-5043-4ff6-6096-08d915520f63 X-MS-TrafficTypeDiagnostic: SN6PR12MB2845: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:551; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FIdWCEba5PvMihH9V8v4zF3bQkbJWxh0oJMl0zP5dXIjUH8x12scsTLi2HxMJlb/QssNik2mDoiozhwFMmcYkOOuhplMcOAaYpYIg/fzMC1l1iz/r3f9n/jYpqj6O2ysHYMSi4F5gIt0vKnn0psqEbPQndEdbX6s77AXywHwW5UBlVJYhrlcWwtW5rnHzPCemAzWPVHiTjihFxT9RFup/FjxqwhBgLonj1Ias5cxbidttQhmg6U4QJUetmjOziUOFCkmmBokjvMScUsOIP9kEm+LPCzAPfHpISK4umn4mk5K9WRuRUHts5m50ey5rG9OFy1CMYr/mCmHdxXh4MLn1qQ4Juhx0V3R6o8LkpQuPRivt86ZvnhCuIrN3lLRKvoYdzkfzzyM+r9v6atmRLTsBtQYK2XZLKLoom3mZLAaBueGMem06bvSBULa664jx0a6Y/Ss6PdzRHVKVsZ6+/bdCQKi4v509nWsXCNBIP5GtwNFoUUozRP7Eap4EixCpcXuLLY/xwaDHEaWIv7P9Nl0tvSxW2JpD2xyjUWoqj5sFiKjpnpT/0BAw1JNnzYFvUtGcNGumz0l0ze+RyiBL6UHE3bC8hP6NDCZ6zCXyE+HCzo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB4623.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(39860400002)(396003)(346002)(136003)(366004)(6486002)(8676002)(54906003)(316002)(6512007)(16526019)(6636002)(478600001)(1076003)(186003)(4326008)(44832011)(2906002)(6506007)(8936002)(5660300002)(2616005)(38100700002)(36756003)(86362001)(6666004)(66476007)(66946007)(66556008)(83380400001)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: u8iHqv8tz9BHH08oKkW0lWy+cVTbTQr+sNaKsxJOFnpNCoHi6ienOySoSYOtdAsqtZWqURt0kPBQn8bW/cO7UvWGWVxk/7MN4LL4cAgY0Ey0BvXLazUbVY7reJIczrZThoQXR9eVTD67J8QQFuy/OUwyD39E1Zis4m+LvFlhanVLffF5juJkg7MSzN3P7niWvBNibx0a3fDmjFIUnfl2nkyvlB06P5s1OqM3ZJiYgNiMi+zfPJvaTHBGVO8A5NxBYJ6XSIQEIJUYHr70Stjt1tSWNMLn3CLxvX5uDNag9BKeDvscL4acYDhm0Mg8VGaSMII4Fb5Qthd3YzufXp2M+7+l/8qveJukSWe/jf6+JJ88HZEaKHKKZMjTP0fOcoxu0jYcUJwnB7fGByHyfqbknXzBW293697/N0euPVTv4fcmHJjbPrA1M9yaAfEGvks476KhrWgkFKLpr4Xjm3vbTuAC/SwpIYfgpQrwymZCoZpRHFkTh7JuCPzgDHwO1X/zGJCyGh3TJqnKaLfpGrTdahBXhvnyIQaVeN2zUcikn+uLHFw/IKDfs7Q+JaEfGh1gF4KT/q7utxmPmmTCTlowDt9gEzLhLi7pjQiLKH746Tr2vOwZxsNZrIkL0msPwAC2UpycnIws5FfPKBiqVrjVWYN3bucLL6f8b0hF9ySUR2Swl8XXvgLJ9UDC5xJdkSoRqJW+g/8ZhAnAb11g33pS2CX3ZHuh8ND6Jfa0t9eXYpxPnY4p/E5Y6hLDIinQFHF1o/A4kPiPfuG177XkS081kXR8l5f4q8RTcZdECGyvGhQp39XRDzoOE5sRwAkD2If8kfuQP3Yq9aMYFhnX1seDDbjleUMuHxKfcVfsby459WkgJYvxMPpfGetzSnjLLB3+DtbBXiBfCBeE69f+CaBODO0FDqUFZ81U9ql1lSZHeRcfYtM9iOQ9SM6jLm8DsnWvDc60yb2AVu880FrSJonHv8HJc30spBvDqYu0MZpcMzih/uukCmWws8zQy0THDhH0o1aIy9NUm+WbLq/VjgWFU0EwvpoJBVec/JjV6QdKLblhWZj4g2zD4MpLYEuGePx9LMqH8coX8xmNv6nZoEMADVnZGKQDCTUOpbDbOwaVZzji8JoYORKBt9CYiSoalEAM9iDXQRmyH6PHFlqpvtVBU7niz+JJt8muSKNpqzqQum73v83BAgctJuO41MKbMsCe3CkR/W3+Xwi3Po8C54lpUZky6XAAwSL+YndZQgWEcgX7disj7xdIzrUOdT0X70onRkByA5LEikpaV9cSIAnLC3iPZfYrK5aF2lQydMuHvEHjgQeSbfDRmsN/Wl/1qvhpjIGPnKFNtQ/2zrL6cf3QYXXXpQoSc6CsOQALjgb12A88sGsyl8p8aUuUKPHPc0s9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc5f59e-5043-4ff6-6096-08d915520f63 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4623.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 14:27:24.0827 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZQtc9Q04ARiFQzokZZctQsHV7H4uApNgsNfGDqe/v8sPsmekPREdT+07h+OaIp+NAnyCvBq2yHew9QcmHKJubw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2845 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, Felix.Kuehling@amd.com, Bjorn Helgaas , helgaas@kernel.org, Alexander.Deucher@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This helps converting PCI drivers sysfs attributes to static. Analogous to' commit b71b283e3d6d ("USB: add support for dev_groups to struct usb_driver")' Signed-off-by: Andrey Grodzovsky Suggested-by: Greg Kroah-Hartman Acked-by: Bjorn Helgaas --- drivers/pci/pci-driver.c | 1 + include/linux/pci.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ec44a79e951a..3a72352aa5cf 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1385,6 +1385,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, drv->driver.owner = owner; drv->driver.mod_name = mod_name; drv->driver.groups = drv->groups; + drv->driver.dev_groups = drv->dev_groups; spin_lock_init(&drv->dynids.lock); INIT_LIST_HEAD(&drv->dynids.list); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b77..b57755b03009 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -858,6 +858,8 @@ struct module; * number of VFs to enable via sysfs "sriov_numvfs" file. * @err_handler: See Documentation/PCI/pci-error-recovery.rst * @groups: Sysfs attribute groups. + * @dev_groups: Attributes attached to the device that will be + * created once it is bound to the driver. * @driver: Driver model structure. * @dynids: List of dynamically added device IDs. */ @@ -873,6 +875,7 @@ struct pci_driver { int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ const struct pci_error_handlers *err_handler; const struct attribute_group **groups; + const struct attribute_group **dev_groups; struct device_driver driver; struct pci_dynids dynids; };