Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751036AbdFSQ02 (ORCPT ); Mon, 19 Jun 2017 12:26:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34490 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbdFSQ01 (ORCPT ); Mon, 19 Jun 2017 12:26:27 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BA26E80F98 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jeyu@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BA26E80F98 Date: Mon, 19 Jun 2017 18:26:23 +0200 From: Jessica Yu To: Corentin Labbe Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] kernel/module.c: Invert add_usage_link and del_usage_link functions Message-ID: <20170619162622.7hbxm6k53f43nooh@redbean> References: <20170606121740.350-1-clabbe.montjoie@gmail.com> <20170606121740.350-2-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170606121740.350-2-clabbe.montjoie@gmail.com> X-OS: Linux redbean 4.11.4-200.fc25.x86_64 x86_64 User-Agent: NeoMutt/20170609 (1.8.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 19 Jun 2017 16:26:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1879 Lines: 63 +++ Corentin Labbe [06/06/17 14:17 +0200]: >This patch just swap del_usage_link() before add_usage_link(). > >Signed-off-by: Corentin Labbe Could you combine this with the 2nd patch? By itself this patch doesn't tell us much. Additionally, could you explain in the changelog (of the 2nd patch) why they needed to be swapped (i.e., so del_usage_links() can be called from add_usage_links()). Thanks! Jessica > kernel/module.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > >diff --git a/kernel/module.c b/kernel/module.c >index e3e9dbba6a5b..983b81f6d4ba 100644 >--- a/kernel/module.c >+++ b/kernel/module.c >@@ -1663,29 +1663,29 @@ static inline void remove_notes_attrs(struct module *mod) > } > #endif /* CONFIG_KALLSYMS */ > >-static void add_usage_links(struct module *mod) >+static void del_usage_links(struct module *mod) > { > #ifdef CONFIG_MODULE_UNLOAD > struct module_use *use; >- int nowarn; > > mutex_lock(&module_mutex); >- list_for_each_entry(use, &mod->target_list, target_list) { >- nowarn = sysfs_create_link(use->target->holders_dir, >- &mod->mkobj.kobj, mod->name); >- } >+ list_for_each_entry(use, &mod->target_list, target_list) >+ sysfs_remove_link(use->target->holders_dir, mod->name); > mutex_unlock(&module_mutex); > #endif > } > >-static void del_usage_links(struct module *mod) >+static void add_usage_links(struct module *mod) > { > #ifdef CONFIG_MODULE_UNLOAD > struct module_use *use; >+ int nowarn; > > mutex_lock(&module_mutex); >- list_for_each_entry(use, &mod->target_list, target_list) >- sysfs_remove_link(use->target->holders_dir, mod->name); >+ list_for_each_entry(use, &mod->target_list, target_list) { >+ nowarn = sysfs_create_link(use->target->holders_dir, >+ &mod->mkobj.kobj, mod->name); >+ } > mutex_unlock(&module_mutex); > #endif > } >-- >2.13.0 >