From patchwork Sat Oct 13 17:06:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 10640425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC84615E2 for ; Sat, 13 Oct 2018 17:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C40F229359 for ; Sat, 13 Oct 2018 17:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B45A32AB6B; Sat, 13 Oct 2018 17:06:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2420029359 for ; Sat, 13 Oct 2018 17:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbeJNAoZ (ORCPT ); Sat, 13 Oct 2018 20:44:25 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46598 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbeJNAoZ (ORCPT ); Sat, 13 Oct 2018 20:44:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Date:Message-ID:Subject:From:Cc:To:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mv0toIaNlwA0+Z3ryAFpIuL9LEcHiD181vJNGTXalvU=; b=GSDSxSfwr/FVK/e/rhBeEGOixi E2t2FhL76c+schVkRvFPPK91kD5Kku0wP0euKBqcYxAVwUrIBQ32Xcr8ChUPe0zqs1ufsHM/ipaMH tE2H1LWiM/+n+kHUF5/obqhJ35SWIfM3m0BYUfxzdGOv3iSSdQi1inYxDTzJOxc/RIGKRSvzOmsAW t2ceKzKGDWEKb6mI7e8Qua6giOErAyx+Ntl1Ov+RmkNQmZ7htCNqYq97CFAEPnW0tIsHB2cJv6E/X bn69TBk+xoL+3pGyp6PZ1iP53PPaAi6ESiXsbI4fTt9g3tvdNUrMD7Zi64Y0ki2TN2Mh8iM+FjP3z WYcDmTXQ==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBNMp-0007nT-TY; Sat, 13 Oct 2018 17:06:20 +0000 To: LKML , "linux-input@vger.kernel.org" Cc: Robert Jarzmik , Charles Keepax , Dmitry Torokhov , Mark Brown , patches@opensource.cirrus.com From: Randy Dunlap Subject: [PATCH] input: touchscreen: fix wm97xx-ts exit path Message-ID: Date: Sat, 13 Oct 2018 10:06:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Randy Dunlap Loading then unloading wm97xx-ts.ko when CONFIG_AC97_BUS=m causes a WARNING: from drivers/base/driver.c: Unexpected driver unregister! WARNING: CPU: 0 PID: 1709 at ../drivers/base/driver.c:193 driver_unregister+0x30/0x40 Fix this by only calling driver_unregister() with the same condition that driver_register() is called. Fixes: ae9d1b5fbd7b ("Input: wm97xx: add new AC97 bus support") Signed-off-by: Randy Dunlap Cc: Robert Jarzmik Cc: Charles Keepax Cc: Dmitry Torokhov Cc: Mark Brown Cc: patches@opensource.cirrus.com Cc: linux-input@vger.kernel.org --- drivers/input/touchscreen/wm97xx-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- lnx-419-rc7.orig/drivers/input/touchscreen/wm97xx-core.c +++ lnx-419-rc7/drivers/input/touchscreen/wm97xx-core.c @@ -929,7 +929,8 @@ static int __init wm97xx_init(void) static void __exit wm97xx_exit(void) { - driver_unregister(&wm97xx_driver); + if (IS_BUILTIN(CONFIG_AC97_BUS)) + driver_unregister(&wm97xx_driver); platform_driver_unregister(&wm97xx_mfd_driver); }