From patchwork Sat Mar 18 13:45:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 740607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ot0-x237.google.com (mail-ot0-x237.google.com [IPv6:2607:f8b0:4003:c0f::237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vlk4g4vb3z9s1h for ; Sun, 19 Mar 2017 00:45:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="RdHzN1OH"; dkim-atps=neutral Received: by mail-ot0-x237.google.com with SMTP id i1sf47839291ota.0 for ; Sat, 18 Mar 2017 06:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:dmarc-filter:dkim-filter:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=ucq/tbmezd13ghI04oGYAaPZ7cHXT0oySS5itJbGacQ=; b=RdHzN1OH3xIwMocfXhxxiPiY4CTkzLTdnnAyvneu0idZNuDmiM3NFKVYD2KHLBzJMo +uTLmNuaMI8O5lGNtrk4wKxmAddwz402SmIBkHVCtPNhg8D82R/vjt232fjopLv08eqU RM4Htitrk7oHXv2/esgxBWuRWCGKkU+2Pt1XxgnZNp8HpgH7Fe8AeF2vEd2bOWzcAqDC BWEnqylCjuFfIsP3DodHDLU4wW1tnFND9SGWVkBHImHC+nCkiUZGiFtY3FGHBFRYOW39 bupMejP55cpZRQ0Ya2W9x6jZZp7EjxgyPXPLeDyBkjAfF+/hsRKUL27LbTfUv9s2YN3h ZttA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:dmarc-filter:dkim-filter :from:to:cc:subject:date:message-id:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=ucq/tbmezd13ghI04oGYAaPZ7cHXT0oySS5itJbGacQ=; b=ZV9LoyI6e8I5YY3T9snCRGI3KxOgFJQaCeoWxX/+p7Gz+IIsAm54i/NoNZmtvngVdT eUkiTutdw6ayhwTt94w4OqfzI0k2ZUD6SSD8ImRr0D5gexRD7xLsZcuhlS3B2UG3RlxH +EQkpaMbkWlbDvg5b5NQlXs2m/48ieBaVzOfHYDpce+5sTuuIW5TYqPypCKuYg6cAQip CpJGlih6/lmSwunIRdmqXL2Fp4LYBdGFiTPdv02bsWpo/4fc0GLKaRqRQ8DMXbiy2ba0 s/xRf8uIhWx27EdajTW4QZWxFE9UFmqionAG0sCPtGpuyfCFyKm/GDv8upb7f2b22FSa N1Vw== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: AFeK/H2jVCN00yDoN6n7SY61FXsa62UPG8+28Wy6jUkY3OlWC8AtdakPBCQ7ZpE+6M911w== X-Received: by 10.157.41.152 with SMTP id n24mr2158419otb.0.1489844753544; Sat, 18 Mar 2017 06:45:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.157.63.218 with SMTP id i26ls10102544ote.48.gmail; Sat, 18 Mar 2017 06:45:53 -0700 (PDT) X-Received: by 10.200.3.229 with SMTP id z37mr2292595qtg.8.1489844753290; Sat, 18 Mar 2017 06:45:53 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by gmr-mx.google.com with ESMTPS id u134si505741ywg.2.2017.03.18.06.45.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Mar 2017 06:45:53 -0700 (PDT) Received-SPF: pass (google.com: domain of hdegoede@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C17E80473; Sat, 18 Mar 2017 13:45:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1C17E80473 DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1C17E80473 Received: from shalem.localdomain.com (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id D200617969; Sat, 18 Mar 2017 13:45:51 +0000 (UTC) From: Hans de Goede To: Alessandro Zummo , Alexandre Belloni Cc: Hans de Goede , the.dr.hax@gmail.com, rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH] rtc: cmos: Do not assume irq 8 for rtc when there are no legacy irqs Date: Sat, 18 Mar 2017 14:45:49 +0100 Message-Id: <20170318134549.28052-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 18 Mar 2017 13:45:53 +0000 (UTC) X-Original-Sender: hdegoede@redhat.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of hdegoede@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=hdegoede@redhat.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-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On some systems (e.g. Intel Bay Trail systems) the legacy PIC is not used, in this case virq 8 will be a random irq, rather then hw_irq 8 from the PIC. Requesting virq 8 in this case will not help us to get alarm irqs and may cause problems for other drivers which actually do need virq 8, for example on an Asus Transformer T100TA this leads to: [ 28.745155] genirq: Flags mismatch irq 8. 00000088 (mmc0) vs. 00000080 (rtc0) [ 28.753700] mmc0: Failed to request IRQ 8: -16 [ 28.975934] sdhci-acpi: probe of 80860F14:01 failed with error -16 This commit fixes this by making the rtc-cmos driver continue without using an irq rather then claiming irq 8 when no irq is specified in the pnp-info and there are no legacy-irqs. Signed-off-by: Hans de Goede --- drivers/rtc/rtc-cmos.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index f4a96db..b3de973 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -41,6 +41,9 @@ #include #include #include +#ifdef CONFIG_X86 +#include +#endif /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ #include @@ -1193,17 +1196,23 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) { cmos_wake_setup(&pnp->dev); - if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) + if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0)) { + unsigned int irq = 0; +#ifdef CONFIG_X86 /* Some machines contain a PNP entry for the RTC, but * don't define the IRQ. It should always be safe to - * hardcode it in these cases + * hardcode it on systems with a legacy PIC. */ + if (nr_legacy_irqs()) + irq = 8; +#endif return cmos_do_probe(&pnp->dev, - pnp_get_resource(pnp, IORESOURCE_IO, 0), 8); - else + pnp_get_resource(pnp, IORESOURCE_IO, 0), irq); + } else { return cmos_do_probe(&pnp->dev, pnp_get_resource(pnp, IORESOURCE_IO, 0), pnp_irq(pnp, 0)); + } } static void cmos_pnp_remove(struct pnp_dev *pnp)