Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932761AbbHJTy6 (ORCPT ); Mon, 10 Aug 2015 15:54:58 -0400 Received: from SMTP.ANDREW.CMU.EDU ([128.2.105.204]:53585 "EHLO smtp.andrew.cmu.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbbHJTy5 (ORCPT ); Mon, 10 Aug 2015 15:54:57 -0400 Date: Mon, 10 Aug 2015 15:51:43 -0400 From: Gabriel Somlo To: Greg KH Cc: linux-kernel@vger.kernel.org, kernelnewbies@kernelnewbies.org Subject: [PATCH] kobject: move EXPORT_SYMBOL() macros next to corresponding definitions Message-ID: <20150810195143.GP31816@HEDWIG.INI.CMU.EDU> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-PMX-Version: 6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.8.10.194217 X-SMTP-Spam-Clean: 8% ( MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, FROM_EDU_TLD 0, NO_URI_HTTPS 0, __ANY_URI 0, __CD 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_FROM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0) X-SMTP-Spam-Score: 8% Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3036 Lines: 102 Move EXPORT_SYMBOL() macros in kobject.c from the end of the file next to the function definitions to which they belong. Signed-off-by: Gabriel Somlo --- On Mon, Aug 10, 2015 at 11:54:00AM -0700, Greg KH wrote: > > > > > > > > EXPORT_SYMBOL(kset_register); > > > > EXPORT_SYMBOL(kset_unregister); > > > > +EXPORT_SYMBOL(kset_find_obj); > > > > > > checkpatch doesn't like this for obvious reasons :) > > > > When I run checkpatch on this one, it comes back fine. Could you > > please elaborate ? > > > > [staging]$ scripts/checkpatch.pl > > 0002-kobject-export-kset_find_obj-to-be-used-from-modules.patch > > total: 0 errors, 0 warnings, 4 lines checked > > > > 0002-kobject-export-kset_find_obj-to-be-used-from-modules.patch has no > > obvious style problems and is ready for submission. > > EXPORT_SYMBOL() should be below the function definition itself, not at > the bottom of the file. Odd that checkpatch doesn't catch this when > done in this manner, it will if you run it on the whole file after your > patch is applied (along with the existing problems.) BTW, when I did that, I was merely trying to immitate what was already in lib/kobject.c. So here's making sure the next person won't get confused the same way I did... :) Thanks much, --Gabriel lib/kobject.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/kobject.c b/lib/kobject.c index 3e3a5c3..0554077 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -568,6 +568,7 @@ void kobject_del(struct kobject *kobj) kobject_put(kobj->parent); kobj->parent = NULL; } +EXPORT_SYMBOL(kobject_del); /** * kobject_get - increment refcount for object. @@ -584,6 +585,7 @@ struct kobject *kobject_get(struct kobject *kobj) } return kobj; } +EXPORT_SYMBOL(kobject_get); static struct kobject * __must_check kobject_get_unless_zero(struct kobject *kobj) { @@ -675,6 +677,7 @@ void kobject_put(struct kobject *kobj) kref_put(&kobj->kref, kobject_release); } } +EXPORT_SYMBOL(kobject_put); static void dynamic_kobj_release(struct kobject *kobj) { @@ -803,6 +806,7 @@ int kset_register(struct kset *k) kobject_uevent(&k->kobj, KOBJ_ADD); return 0; } +EXPORT_SYMBOL(kset_register); /** * kset_unregister - remove a kset. @@ -815,6 +819,7 @@ void kset_unregister(struct kset *k) kobject_del(&k->kobj); kobject_put(&k->kobj); } +EXPORT_SYMBOL(kset_unregister); /** * kset_find_obj - search for object in kset. @@ -1051,10 +1056,3 @@ void kobj_ns_drop(enum kobj_ns_type type, void *ns) kobj_ns_ops_tbl[type]->drop_ns(ns); spin_unlock(&kobj_ns_type_lock); } - -EXPORT_SYMBOL(kobject_get); -EXPORT_SYMBOL(kobject_put); -EXPORT_SYMBOL(kobject_del); - -EXPORT_SYMBOL(kset_register); -EXPORT_SYMBOL(kset_unregister); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/