From patchwork Sat Oct 7 22:37:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 115152 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1039383qgn; Sat, 7 Oct 2017 15:53:10 -0700 (PDT) X-Google-Smtp-Source: AOwi7QC2FNa5nBBAovMkfFGvVjoHFFMToxqeBzvxs5cdFbLsaoPn7WD9BLXwHL7nK3cV5GpwRX3J X-Received: by 10.99.108.132 with SMTP id h126mr5557676pgc.434.1507416790605; Sat, 07 Oct 2017 15:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507416790; cv=none; d=google.com; s=arc-20160816; b=Ntyl+VC2+mbCqimr7lJaxWkw+lHqP1HxcGuwiCq2typdZ74TxIVnynk7ywEcrTCY2j G4LwBAYVUzgWn0IW0g+eXLqmAM46jl9TLwUC/ecLZtOre6DPjcQbxCVf6WxBmzA/TM0A nwTZJxByZEaQCjAvm9ke0x2ZnOGIH89OOk3WhFv3sowkS1RGNTK0vzzDczJZftzXGA0x ZVeQVornqItSWlbTdCqzPC9a+Mkas0OIwordmdectaCP205fxubNBb5qp+czrZL/bVIh w8cezZiqRMX94a/6Ej3eNFdlyxBuIJJmr5Kq5SICruYAeYloeRXy9a/xBT1JzJ1NqJZ3 Iy4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:dkim-signature :dkim-signature:cc:from:dkim-signature:arc-authentication-results; bh=oKJSTcJe+6ZR1PsGsFuuENjQXyPbqpgB4G/Ccii1898=; b=U3O1L/DmdDiHdgTvFbXiNDYJWhOCGZzDBHMkHBuCK3GZO8GlNpB9U/yiEjFmomW0WQ XwxIS2MT6d6sYhimJ6Xn8UF6ni7GkiDfvIBaMYfVdg15QXoKQQTPSMYuVaru5cXcniY+ 2+ONd9oi3GxQsoCJfVQtBCGw1H7kAwxk5vaqknAWqyu5oBmSaGN9BGWx5tKesLD3VMuw xTmktdOEhkl6ynHTXzu42tBVj+9IhwpRG7eDZTPI3z3tQBP+PiBqlpItLwXk4tbxw4oU r9NmXbBaswGMU59qsoLCVr98k5N5sprqhJ6mxnsEfUhK1Oq+ghmh1PvW6vGJFU6jsz0s nmXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verizon.com header.s=corp header.b=fDlwScbS; dkim=fail header.i=@verizon.com header.s=corp header.b=UaN10efh; dkim=fail header.i=@verizon.com header.s=corp header.b=UaN10efh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si3911323pld.259.2017.10.07.15.53.10; Sat, 07 Oct 2017 15:53:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@verizon.com header.s=corp header.b=fDlwScbS; dkim=fail header.i=@verizon.com header.s=corp header.b=UaN10efh; dkim=fail header.i=@verizon.com header.s=corp header.b=UaN10efh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbdJGWxJ (ORCPT + 8 others); Sat, 7 Oct 2017 18:53:09 -0400 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:17724 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbdJGWiE (ORCPT ); Sat, 7 Oct 2017 18:38:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507415884; x=1538951884; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=mXiUuKqZxvSyBfUE7Sl62RFFP2mEmbA2CADv60oaZVg=; b=fDlwScbSuv4GMlbL91EtMHT4UY2RY7K239lLe+V7Isa3Fsj2OFvH6pSl EDpDxJUoSC2fQLW+b6s88/2O2LfrTanIa2spFOCCzvzNHhmp590yHGEid BgcLoVTUgnScQbZrGO1alDJ7LYfYHu7xYQqZAlNoiZNC6/8wJvHwSgJGI g=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by fldsmtpe03.verizon.com with ESMTP; 07 Oct 2017 22:37:50 +0000 From: "Levin, Alexander (Sasha Levin)" Cc: Linus Walleij , Lee Jones , "Levin, Alexander (Sasha Levin)" Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Oct 2017 22:37:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507415870; x=1538951870; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=mXiUuKqZxvSyBfUE7Sl62RFFP2mEmbA2CADv60oaZVg=; b=UaN10efhMwwU2VPYc0cA5cxcO20IMoSPbWTKnQUWxz5IAfI4L+ViP8Za eNubRp0KGXQsqX0joJHPIaLQvNYPSX8SJNKrvLBwnTF6ypE4gamiFieWS R7w0YUTPoxm1SL02R9OA9VC6hN1KOUDqsKr8zhYXYQaViemZJwmBszdLH 0=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Oct 2017 18:37:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507415870; x=1538951870; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=mXiUuKqZxvSyBfUE7Sl62RFFP2mEmbA2CADv60oaZVg=; b=UaN10efhMwwU2VPYc0cA5cxcO20IMoSPbWTKnQUWxz5IAfI4L+ViP8Za eNubRp0KGXQsqX0joJHPIaLQvNYPSX8SJNKrvLBwnTF6ypE4gamiFieWS R7w0YUTPoxm1SL02R9OA9VC6hN1KOUDqsKr8zhYXYQaViemZJwmBszdLH 0=; X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 07 Oct 2017 22:37:50 +0000 Received: from tbwexch06apd.uswin.ad.vzwcorp.com (153.114.162.30) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sat, 7 Oct 2017 18:37:50 -0400 Received: from OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) by tbwexch06apd.uswin.ad.vzwcorp.com (153.114.162.30) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sat, 7 Oct 2017 18:37:49 -0400 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA19.uswin.ad.vzwcorp.com (144.8.22.197) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sat, 7 Oct 2017 17:37:48 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Sat, 7 Oct 2017 17:37:48 -0500 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH review for 4.4 04/24] mfd: ab8500-sysctrl: Handle probe deferral Thread-Topic: [PATCH review for 4.4 04/24] mfd: ab8500-sysctrl: Handle probe deferral Thread-Index: AQHTP7zkwm9IBDhFy0+uao6Bk+BwfA== Date: Sat, 7 Oct 2017 22:37:44 +0000 Message-ID: <20171007223738.25013-4-alexander.levin@verizon.com> References: <20171007223738.25013-1-alexander.levin@verizon.com> In-Reply-To: <20171007223738.25013-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 7e9c40c63933a643908d686bd89dfc2315e8c70a ] In the current boot, clients making use of the AB8500 sysctrl may be probed before the ab8500-sysctrl driver. This gives them -EINVAL, but should rather give -EPROBE_DEFER. Before this, the abx500 clock driver didn't probe properly, and as a result the codec driver in turn using the clocks did not probe properly. After this patch, everything probes properly. Also add OF compatible-string probing. This driver is all device tree, so let's just make a drive-by-fix of that as well. Signed-off-by: Linus Walleij Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/ab8500-sysctrl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c index 0d1825696153..405ce78c1ef4 100644 --- a/drivers/mfd/ab8500-sysctrl.c +++ b/drivers/mfd/ab8500-sysctrl.c @@ -99,7 +99,7 @@ int ab8500_sysctrl_read(u16 reg, u8 *value) u8 bank; if (sysctrl_dev == NULL) - return -EINVAL; + return -EPROBE_DEFER; bank = (reg >> 8); if (!valid_bank(bank)) @@ -115,11 +115,13 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value) u8 bank; if (sysctrl_dev == NULL) - return -EINVAL; + return -EPROBE_DEFER; bank = (reg >> 8); - if (!valid_bank(bank)) + if (!valid_bank(bank)) { + pr_err("invalid bank\n"); return -EINVAL; + } return abx500_mask_and_set_register_interruptible(sysctrl_dev, bank, (u8)(reg & 0xFF), mask, value); @@ -180,9 +182,15 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id ab8500_sysctrl_match[] = { + { .compatible = "stericsson,ab8500-sysctrl", }, + {} +}; + static struct platform_driver ab8500_sysctrl_driver = { .driver = { .name = "ab8500-sysctrl", + .of_match_table = ab8500_sysctrl_match, }, .probe = ab8500_sysctrl_probe, .remove = ab8500_sysctrl_remove,