From patchwork Thu Aug 2 23:53:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Palatin X-Patchwork-Id: 174819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-lpp01m010-f56.google.com (mail-lpp01m010-f56.google.com [209.85.215.56]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 917152C007B for ; Fri, 3 Aug 2012 09:53:41 +1000 (EST) Received: by lagp5 with SMTP id p5sf40182lag.11 for ; Thu, 02 Aug 2012 16:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=18STgzBAdX0WgzY6GDJeSKIgEjSPO8ySMak8Ywo9oOI=; b=x9sgvdXOLN5a+VwLBDcGkKMV00f+KKB+Xs7buQsXWfk8kFgTfQkirB7wquorqyEg/n MxJNMXcTJA4v7DpIn8pDWK/FtSUJtcZMR/r1KKeSkdfPZf/dp9V47CTSLStX+wlupbwt pcgwZVY63RmAV3XFBN7H/CHM0PKRrgGwZ3F8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:x-gm-message-state:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=18STgzBAdX0WgzY6GDJeSKIgEjSPO8ySMak8Ywo9oOI=; b=mfVje7XMvCP46RZmcAV55DFt3JYhhVTz8/Flj71u+7Nh6hh5oJl+naZcZxAh1KfyHV +0If5Xn8KFtJ50LtgDAoIkAqWPlDIfUM8JuqYKJUrca0N8DZEylFKrC0HGppqGgfqE20 g9JWEQlg+ofdKErRnGM/eAxjufqMzCsL55fAbQJ73we2O1a1Yq896GaYueye4ostAhmG TA6kcHuF7zWBof6P7sFAW9b9jUcfjZNe4AYQbHNQyFAIaB5uvrJ/N1nCQIsXyLOxDljp b+fLrC00qFaKpKgpNUIMAf2n/Ow7jzdOBjThMFn3A5qOv1x6LNf9Y1OlIfLMg4aTOT1A O6mw== Received: by 10.204.156.22 with SMTP id u22mr1010008bkw.32.1343951617033; Thu, 02 Aug 2012 16:53:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.204.157.26 with SMTP id z26ls2972735bkw.1.gmail; Thu, 02 Aug 2012 16:53:36 -0700 (PDT) Received: by 10.204.151.213 with SMTP id d21mr4674233bkw.0.1343951616192; Thu, 02 Aug 2012 16:53:36 -0700 (PDT) Received: by 10.204.151.213 with SMTP id d21mr4674232bkw.0.1343951616179; Thu, 02 Aug 2012 16:53:36 -0700 (PDT) Received: from mail-lb0-f201.google.com (mail-lb0-f201.google.com [209.85.217.201]) by gmr-mx.google.com with ESMTPS id j4si2116811bkj.3.2012.08.02.16.53.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 02 Aug 2012 16:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of vpalatin@google.com designates 209.85.217.201 as permitted sender) client-ip=209.85.217.201; Received: by lbcs4 with SMTP id s4so14122lbc.4 for ; Thu, 02 Aug 2012 16:53:35 -0700 (PDT) Received: by 10.14.174.196 with SMTP id x44mr23178300eel.7.1343951615756; Thu, 02 Aug 2012 16:53:35 -0700 (PDT) Received: by 10.14.174.196 with SMTP id x44mr23178293eel.7.1343951615698; Thu, 02 Aug 2012 16:53:35 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id 46si9900334eed.1.2012.08.02.16.53.35 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 02 Aug 2012 16:53:35 -0700 (PDT) Received: from vpa.mtv.corp.google.com (vpa.mtv.corp.google.com [172.22.72.27]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 7D5EB5C0060; Thu, 2 Aug 2012 16:53:35 -0700 (PDT) Received: by vpa.mtv.corp.google.com (Postfix, from userid 125455) id 9AE4216074A; Thu, 2 Aug 2012 16:53:34 -0700 (PDT) From: Vincent Palatin To: rtc-linux@googlegroups.com Cc: Alessandro Zummo , linux-kernel@vger.kernel.org, Vincent Palatin Subject: [rtc-linux] [PATCH] rtc: recycle id when unloading a rtc driver Date: Thu, 2 Aug 2012 16:53:25 -0700 Message-Id: <1343951605-25722-1-git-send-email-vpalatin@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQlvWkWg6nzW5AGYCFy73PNPnoPUYvodSTeMSxxifF8wHo14OXYNTFDa6sgeRgv33hFCzQO6TyKZDeGhU6QkBG7usmmPUB2IdE7I0T+hObMQOgNP3f1M3s7pRoPlhURqAaMZT4YAr4JM0Aa8T+B69SWg2k9qWbtFpJW+wrtOpMBIdJYNLRWbboMSMFDz0ZfNp9udnlmR X-Original-Sender: vpalatin@chromium.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vpalatin@google.com designates 209.85.217.201 as permitted sender) smtp.mail=vpalatin@google.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , When calling rtc_device_unregister, we are not freeing the id used by the driver. So when doing a unload/load cycle for a RTC driver (e.g. rmmod rtc_cmos && modprobe rtc_cmos), its id is incremented by one. As a consequence, we no longer have neither an rtc0 driver nor a /proc/driver/rtc (as it only exists for the first driver). Signed-off-by: Vincent Palatin --- drivers/rtc/class.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index dc4c274..37b1d82 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -238,6 +238,7 @@ void rtc_device_unregister(struct rtc_device *rtc) rtc_proc_del_device(rtc); device_unregister(&rtc->dev); rtc->ops = NULL; + ida_simple_remove(&rtc_ida, rtc->id); mutex_unlock(&rtc->ops_lock); put_device(&rtc->dev); }