Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755899AbdLONNR (ORCPT ); Fri, 15 Dec 2017 08:13:17 -0500 Received: from mail-oi0-f48.google.com ([209.85.218.48]:41537 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755443AbdLONNP (ORCPT ); Fri, 15 Dec 2017 08:13:15 -0500 X-Google-Smtp-Source: ACJfBouU+68pmKnX0wERnT88Bh6n/XvHdr3kfjgjmb3gOQ+sqXPOW4DcFcwniGmfDG0kJ16RbpldQTkM0eXJvMtvD6g= MIME-Version: 1.0 In-Reply-To: <20171215104204.p7i27sen77ohbmzi@dell> References: <87ec50c846bbc7afc09ba0855aba1cdea6473308.1512048582.git.baolin.wang@linaro.org> <20171215104204.p7i27sen77ohbmzi@dell> From: Arnd Bergmann Date: Fri, 15 Dec 2017 14:13:14 +0100 X-Google-Sender-Auth: k5kA-DHUc1tU5ixujg8qF77Zr4o Message-ID: Subject: Re: [PATCH v6] mfd: syscon: Add hardware spinlock support To: Lee Jones Cc: Baolin Wang , Rob Herring , Mark Rutland , Mark Brown , Linux Kernel Mailing List , DTML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1526 Lines: 37 On Fri, Dec 15, 2017 at 11:42 AM, Lee Jones wrote: >> @@ -87,6 +88,30 @@ static struct syscon *of_syscon_register(struct device_node *np) >> if (ret) >> reg_io_width = 4; >> >> + ret = of_hwspin_lock_get_id(np, 0); >> + if (ret > 0) { >> + syscon_config.hwlock_id = ret; >> + syscon_config.hwlock_mode = HWLOCK_IRQSTATE; >> + } else { >> + switch (ret) { >> + case -ENOENT: >> + /* Ignore missing hwlock, it's optional. */ >> + break; >> + case 0: >> + /* In case of the HWSPINLOCK is not enabled. */ >> + if (!IS_ENABLED(CONFIG_HWSPINLOCK)) >> + break; >> + >> + ret = -EINVAL; >> + /* fall-through */ >> + default: >> + pr_err("Failed to retrieve valid hwlock: %d\n", ret); >> + /* fall-through */ >> + case -EPROBE_DEFER: >> + goto err_regmap; >> + } The 'case 0' seems odd here, are we sure that this is always a failure? >From the of_hwspin_lock_get_id() definition it looks like zero might be valid, and the !CONFIG_HWSPINLOCK implementation appears to be written so that we should consider '0' valid but unused and silently continue with that. If that is generally not the intended use, it should probably return -EINVAL or something like that. Arnd