From patchwork Thu Nov 1 10:14:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 1684201 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7A613E003B for ; Thu, 1 Nov 2012 10:14:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933490Ab2KAKOz (ORCPT ); Thu, 1 Nov 2012 06:14:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60579 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932613Ab2KAKOz (ORCPT ); Thu, 1 Nov 2012 06:14:55 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 782319A78E; Thu, 1 Nov 2012 11:14:54 +0100 (CET) Date: Thu, 1 Nov 2012 11:14:52 +0100 (CET) From: Jiri Kosina To: Benjamin Tissoires Cc: Ratan Nalumasu , linux-input Subject: Re: [BUG v3.6.2, 3.7-rc1] Unable to rmmod any hid special driver In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On Thu, 18 Oct 2012, Benjamin Tissoires wrote: > Hi Guys, > > Commit 4fe9f8e203fdad1524c04beb390f3c6099781ed9 upstream > Commit 57a38d925e665fcd729cd9ad4a75c84e11bd95c9 linux-stable > > This commit "HID: hidraw: don't deallocate memory when it is in use" > prevents users to rmmod then insmod any hid special driver without > either physically unplugging the device or without rmmod-ing the hid > bus itself. > > When the user does a rmmod, hidinput_disconnect is called before > hidraw_disconnect, thus, the hidraw device is still there, but the > input one not. It leads to the fact that the device is not working > anymore even if you call modprobe. > > Any idea to solve that? Guys, how about this? --- drivers/hid/hidraw.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 17d15bb..fce4256 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -560,10 +560,11 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit) { mutex_lock(&minors_lock); if (exists_bit) { - hid_hw_close(hidraw->hid); hidraw->exist = 0; - if (hidraw->open) + if (hidraw->open) { + hid_hw_close(hidraw->hid); wake_up_interruptible(&hidraw->wait); + } } else { --hidraw->open; }