Received: by 10.213.65.68 with SMTP id h4csp1166357imn; Wed, 14 Mar 2018 11:32:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+uUyWThdda8d9g4zEHadeww0T82PNSI9z8EiPl4ujVQk0KjiC4sktpdYpQRh7bzOV1fv9 X-Received: by 10.101.88.196 with SMTP id e4mr2375480pgu.162.1521052369027; Wed, 14 Mar 2018 11:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521052368; cv=none; d=google.com; s=arc-20160816; b=JtNEGkwkpoLKkGoQ9VXTvemwhYncJ496nXZS8A43S8wCeIjtEOqsscSVEaMgz+GAE+ nCordZ6XViTCexsE1uXvGrv7tsMZW9whKB+/TeZg2W0+FOLy+eJWXi+8szbI4eZoy5tZ yqFa0poQdyITqf1pQ4iICrZuoUTcety51PkAnB7AMJlrG4XSA+0iXKCqc333OkGjagis Rh7QchRP3uX8JowRc8IWZH17Bi9+FlTnpb/L/AnwBo+gvYJULKI+qJi2VI9funxx6NAG /qjWIhvR4gXfVz0y6Xqc+2hSywhn3j2+/Kmg5Hg3W0a/i3SJmXifEg5KljlR2kwQ6nrn 9xzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=pvrJJXJsJyjv9VJCOTEqMBBuI0TGIwvK92vY4dVwKXw=; b=NRuPJxlEd5cGWAfGwWRv9r6T7DI/HqrJukUZuBUb+oDD95q9KLV9Wxfnscu5gaXit2 bSwwKLPXmEtAuMF0njIafY/l3cqSTlj68KJynwXfPq4FoaOfd3ysx7nEM3/uNJUXP9B7 LvTEJg3pYLq5l20OIUnByJAntMlEKT8vQM5XHvYQxCnVXXdz6K8nk2oO4q0l4J/rusyB kev8xVr42AR6xKRa3n/XGjgj2YpX8lLBlkL82TR3yTdO4H1Ym9C8ZQYu24q0hILYBFPx aH0V85wbg7IVGc7Z90Ayo7/hmWiObpkwhR6G4a1WhMTBnBKCm3cNlbqlHvi14bkpDfhN 5PtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si2436414pfi.31.2018.03.14.11.32.34; Wed, 14 Mar 2018 11:32:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752181AbeCNSZy (ORCPT + 99 others); Wed, 14 Mar 2018 14:25:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:55037 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbeCNSZv (ORCPT ); Wed, 14 Mar 2018 14:25:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7329FAFA8; Wed, 14 Mar 2018 18:25:50 +0000 (UTC) From: Johannes Thumshirn To: Dan Williams , Ross Zwisler Cc: Linux Kernel Mailinglist , Linux NV-DIMM Mailing List , Johannes Thumshirn Subject: [PATCH 1/3] libnvdimm: provide module_nd_driver wrapper Date: Wed, 14 Mar 2018 19:25:06 +0100 Message-Id: <20180314182508.10351-2-jthumshirn@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180314182508.10351-1-jthumshirn@suse.de> References: <20180314182508.10351-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide a module_nd_driver() wrapper over simple nd_driver_register() nd_driver_unregister() combinations in module_init() and module_exit() respectively. Note an explicit nd_driver_unregister() had to be implemented as nd bus drivers did call device_unregister() direcly in the module_exit() function. Signed-off-by: Johannes Thumshirn --- include/linux/nd.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/nd.h b/include/linux/nd.h index 5dc6b695437d..43c181a6add5 100644 --- a/include/linux/nd.h +++ b/include/linux/nd.h @@ -180,6 +180,12 @@ struct nd_region; void nvdimm_region_notify(struct nd_region *nd_region, enum nvdimm_event event); int __must_check __nd_driver_register(struct nd_device_driver *nd_drv, struct module *module, const char *mod_name); +static inline void nd_driver_unregister(struct nd_device_driver *drv) +{ + driver_unregister(&drv->drv); +} #define nd_driver_register(driver) \ __nd_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) +#define module_nd_driver(driver) \ + module_driver(driver, nd_driver_register, nd_driver_unregister) #endif /* __LINUX_ND_H__ */ -- 2.13.6