Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp182412imp; Tue, 19 Feb 2019 21:18:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IaI8u7nKRbwGZXFQRibXElK/UQBO4Rd5QFxzs4YtI1jlz0KOw9XN1cv9V+Sv+MYxMDTMtvH X-Received: by 2002:a65:63c8:: with SMTP id n8mr4730360pgv.158.1550639936448; Tue, 19 Feb 2019 21:18:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550639936; cv=none; d=google.com; s=arc-20160816; b=heRabhdieFqYqNOYpNhl/KhClVBzQa3dbPYJzZ+32VolN8Z+zewpQNsFQ/5J7BVzQv Q8psAL3T4sCaPt9k8Xgjv6kNthxkLTndem0kIeJFLom0aCLWZiWfanr0Y6jcq/AhXvgR LbXvFCacT3mgfiimZLZpsmmiJFmtbP1k33CCUNJlzcRHKXnZBVT1r5h6lCssJV/YXnwV C6hukXvzgSHYea/T+A/ufSoLxvqZaBHhCArttHgorNgGWn8su/7YPWgEwx5QsMbH3Kqs 9YTqO2dRVXKG2kwo6mfQQ9JZMxmm4mv9IzwPcz9lc70lWg632k/nWZEIBHiHbVW+QM05 o+9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RusBdzrjtJSH0Xq6Q9xgO/MNbLZkhFf25LwFLQBcXCw=; b=Iaw9tSkHFUfDjjIQvv533mc6ANNMRRAFdJcWEdllW5R0gClGZkV41bfq2RwDjeP0kv UQvFXdGC1Cxpt9hqZr8JKycBZP2xxlJlB9/lB9rqgEFvlPYtnE3FVVM2N3f1JlcaENFj xkxUS4EIMaSc6/lweYLappS5RNfKhk50Jq2tKwF9HpBrllH0XfHjslANJnuK0kRBTkGZ lWEjANo7xfAyzuUQgQkdq2tjur2wXuTgzmuz3M2NIYQDufwLdY191twfv5txIenbufJU R1cWwrmJmuMpoqgMUMJUULP5ZHkkmQ83Ja+6MOZJqMii2LAtEEJ7Gtaex3W1TJGy6ONM zpzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=naqPk+Jp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si18219778plr.211.2019.02.19.21.18.41; Tue, 19 Feb 2019 21:18:56 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=naqPk+Jp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfBTFSM (ORCPT + 99 others); Wed, 20 Feb 2019 00:18:12 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:55582 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfBTFSL (ORCPT ); Wed, 20 Feb 2019 00:18:11 -0500 Received: by mail-it1-f194.google.com with SMTP id z131so12412688itf.5 for ; Tue, 19 Feb 2019 21:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RusBdzrjtJSH0Xq6Q9xgO/MNbLZkhFf25LwFLQBcXCw=; b=naqPk+JpiiJn46wauAdwyuA3vCKUtvsRuKh+Nls5G4wHhvZEmIRyHjqRSslsW9ZXxe f1qpMqie5QjM//rcGEjRjpbK6xfPTA6e5E9CQi/YwzTr5pxNLNajQz76XG076yXu2Udh FH14u/0H0syD2C9j/CKlv+YaiIDYi/NnAnTuHagPh5V9A5YGioqu2TF/zf53I12bjd7o yLtUi/5uty07JV4f1H8Vwvvu/zw5DbM1WqyhvolQCyBNhYO4wFSICt0mznQlLVs9K3DF Jgu5gYGILjH4FLkNwPE7PUF1Dx13zKM/H3rq6gwzTQmm92VJmLATy18i2HA3k4B7wgEC M5xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RusBdzrjtJSH0Xq6Q9xgO/MNbLZkhFf25LwFLQBcXCw=; b=rrnwRWF3RVKcMyYhTrjRYB/8poa1QuRiji16VAbwK2W9907FzFJUD4LlBZAyWHzVTG 3FMpjBHsVwuSwwSSYziI1RvKczjlkOafd6ceW4uLFJtKMXxeDHKsWN2pD5Pz/09zFd8M 9p/8gyLQO3ZUCus8Y5rAlyQ2yx8c4SQ2bLftVI3v3Xy8Ktm34KX9PVROsUEBj6Uj3WQ3 rlwvmRcj6f+PI3BbTRsIsbbsRGQMw0++3xDYwiTmoiwtnKMVG2wa+SqUyTOCOTzRNFle iG3gyjta0AOYhA93drkD4JBccpWlLdlDaDmHUGmusiMU0j7cIDiCK1URwEglSGm4DyJA vY4w== X-Gm-Message-State: AHQUAuaZh27rVeole2O/vN64hVHYKPKkeGJLZgrCWhFKzyi9N0TF5+rE jkO3H1V/W4WmTvjZKsMaOC0= X-Received: by 2002:a6b:6003:: with SMTP id r3mr7524725iog.231.1550639890225; Tue, 19 Feb 2019 21:18:10 -0800 (PST) Received: from localhost.localdomain (c-73-242-244-99.hsd1.nm.comcast.net. [73.242.244.99]) by smtp.gmail.com with ESMTPSA id k64sm2297550itb.7.2019.02.19.21.18.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 21:18:09 -0800 (PST) From: George Hilliard To: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org, Neil Brown , George Hilliard Subject: [PATCH 04/10] staging: mt7621-mmc: Fix warning when reloading module with debug msgs enabled Date: Tue, 19 Feb 2019 22:17:48 -0700 Message-Id: <20190220051754.12195-5-thirtythreeforty@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220051754.12195-1-thirtythreeforty@gmail.com> References: <20190220051754.12195-1-thirtythreeforty@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel complained: [ 510.277151] WARNING: CPU: 0 PID: 395 at fs/proc/generic.c:360 proc_register+0xf0/0x108 [ 510.292891] proc_dir_entry '/proc/msdc_debug' already registered when doing a modprobe/rmmod/modprobe of this module if debug messages are compiled in. Fix this by removing the proc entry when the module is unloaded. Signed-off-by: George Hilliard --- drivers/staging/mt7621-mmc/dbg.c | 15 ++++++++++++--- drivers/staging/mt7621-mmc/dbg.h | 3 ++- drivers/staging/mt7621-mmc/sd.c | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 69b38c7e3179..5764b80893e9 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -295,9 +295,18 @@ static const struct file_operations msdc_debug_fops = { .release = single_release, }; -void msdc_debug_proc_init(void) +// Keep ahold of the proc entry we create so it can be freed during +// module removal +struct proc_dir_entry *msdc_debug_proc_entry; + +void __init msdc_debug_proc_init(void) { - proc_create("msdc_debug", 0660, NULL, &msdc_debug_fops); + msdc_debug_proc_entry = proc_create("msdc_debug", 0660, + NULL, &msdc_debug_fops); +} + +void __exit msdc_debug_proc_deinit(void) +{ + proc_remove(msdc_debug_proc_entry); } -EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 2d447b2d92ae..d100324aa3fe 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -93,7 +93,8 @@ enum msdc_dbg { extern unsigned int sd_debug_zone[4]; #define TAG "msdc" -void msdc_debug_proc_init(void); +void __init msdc_debug_proc_init(void); +void __exit msdc_debug_proc_deinit(void); u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32); void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks); diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 1d357b898952..a7c7ec0d7bbb 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1843,6 +1843,10 @@ static int __init mt_msdc_init(void) static void __exit mt_msdc_exit(void) { +#if defined(MT6575_SD_DEBUG) + msdc_debug_proc_deinit(); +#endif + platform_driver_unregister(&mt_msdc_driver); } -- 2.20.1