From patchwork Fri Jan 13 09:53:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 91297 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp112165qgi; Fri, 13 Jan 2017 02:01:44 -0800 (PST) X-Received: by 10.84.164.106 with SMTP id m39mr28287188plg.97.1484301704829; Fri, 13 Jan 2017 02:01:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si12247756plc.225.2017.01.13.02.01.44; Fri, 13 Jan 2017 02:01:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbdAMKBB (ORCPT + 25 others); Fri, 13 Jan 2017 05:01:01 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35680 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbdAMKAs (ORCPT ); Fri, 13 Jan 2017 05:00:48 -0500 Received: by mail-lf0-f41.google.com with SMTP id m78so32892500lfg.2 for ; Fri, 13 Jan 2017 02:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=72OPhF0RHyhJRxO8P4v52RkhdqAgsf9MmNeJJc3/jr0=; b=NTVhw6pwI9vcVbxOjs8N9o2jX71eJucDgufcjAEz5X5A6jiVc9QLjF+jwfqjqHMpJ8 1gFXnvPAoO9nds9T3pbS92GWdw1LF+7LoUZ9dKRE3P8CuMCNgkHBAAonLAH3FeAE3kOi x7zoQ1VZ5/ivrZWY3z2mFdZAUnV9JF19AClzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=72OPhF0RHyhJRxO8P4v52RkhdqAgsf9MmNeJJc3/jr0=; b=aVUH9ke4ajXIlqzbOgP8T+0xYQtIAihh/mftAPA8Qz4t+5yFY8AObLSJGn67JRoY2v AUZbk3PD88S07v0xUB8BRQru3tczWGeU7xljHzTP4/aBayc12v9A/Qw8lEYMPECf/mxc yNeOSdyeZaOveVBWV5YhNV6y/eRhvPpXLfjN0I1XD2nz6ohmeETFWAr2evRJFPp2T/Ym DiHUzl7yGMcM+oUimHn0kNHMEss2Mges9MhxVoPacdyD9ePa20QWGIQrONeuV2ecEwZJ SN9tSrC9guFjrr82AfX0AmGDRCeUWONSkFhiW4Y8at7ZyK3vFD7nCxGGAdFC69bTwjvc 34uA== X-Gm-Message-State: AIkVDXLMnM490AMcJPQixJd8jrXGBEWknFCPDlmly5phc/cFXyUnnkrL71HObqi38VT15SMc X-Received: by 10.25.99.134 with SMTP id v6mr7259606lfi.170.1484301241633; Fri, 13 Jan 2017 01:54:01 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j138sm3506033lfe.19.2017.01.13.01.54.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 01:54:00 -0800 (PST) From: Linus Walleij To: lee.jones@linaro.org, linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [PATCH] mfd: ab8500-sysctrl: Handle probe deferral Date: Fri, 13 Jan 2017 10:53:55 +0100 Message-Id: <20170113095355.5406-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/mfd/ab8500-sysctrl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.9.3 diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c index 80c0efa66ac1..5b0a0850ef69 100644 --- a/drivers/mfd/ab8500-sysctrl.c +++ b/drivers/mfd/ab8500-sysctrl.c @@ -101,7 +101,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)) @@ -117,11 +117,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); @@ -148,9 +150,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,