From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932924AbcHWPBc (ORCPT ); Tue, 23 Aug 2016 11:01:32 -0400 Received: from foss.arm.com ([217.140.101.70]:37936 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcHWPBa (ORCPT ); Tue, 23 Aug 2016 11:01:30 -0400 Subject: Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported To: Neil Armstrong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1471515066-3626-1-git-send-email-narmstrong@baylibre.com> <1471515066-3626-8-git-send-email-narmstrong@baylibre.com> <74d35f80-8499-cadf-798c-9b296218305c@arm.com> <86c4042a-a892-b5c4-cc75-c2139e80e226@baylibre.com> <5e627a97-88f6-c7cf-1d64-6439cb708aff@arm.com> <895da5b6-baec-daf8-814b-76bd9ebcbbbc@baylibre.com> Cc: Sudeep Holla , linux-amlogic@lists.infradead.org, khilman@baylibre.com, heiko@sntech.de, wxt@rock-chips.com, frank.wang@rock-chips.com From: Sudeep Holla Organization: ARM Message-ID: <584cd7fc-c6dd-d380-0842-ca663fa298ab@arm.com> Date: Tue, 23 Aug 2016 16:01:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <895da5b6-baec-daf8-814b-76bd9ebcbbbc@baylibre.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/08/16 15:55, Neil Armstrong wrote: > On 08/23/2016 04:54 PM, Sudeep Holla wrote: >> >> >> On 23/08/16 09:23, Neil Armstrong wrote: >>> On 08/19/2016 06:46 PM, Sudeep Holla wrote: >>>> >>>> >>>> On 18/08/16 11:11, Neil Armstrong wrote: >>>>> In Amlogic GXBB Legacy SCPI, the LEGACY_SCPI_CMD_SCPI_CAPABILITIES report >>>>> as SCPI_ERR_SUPPORT, so do not fail if this command is not supported. >>>>> >>>>> Signed-off-by: Neil Armstrong >>>>> --- >>>>> drivers/firmware/arm_scpi.c | 12 +++++++----- >>>>> 1 file changed, 7 insertions(+), 5 deletions(-) >>>>> >>>>> diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c >>>>> index 3fe39fe..d3be4c5 100644 >>>>> --- a/drivers/firmware/arm_scpi.c >>>>> +++ b/drivers/firmware/arm_scpi.c >>>>> @@ -1111,12 +1111,13 @@ err: >>>>> ret = scpi_info->ops->init_versions(scpi_info); >>>>> else >>>>> ret = scpi_init_versions(scpi_info); >>>>> - if (ret) { >>>>> + if (ret && ret != -EOPNOTSUPP) { >>>>> dev_err(dev, "incorrect or no SCP firmware found\n"); >>>>> scpi_remove(pdev); >>>>> return ret; >>>>> } >>>>> >>>> >>>> Why not deal it in init_versions itself. >>>> >>>>> + if (ret != -EOPNOTSUPP) { >>>>> _dev_info(dev, "SCP Protocol %d.%d Firmware %d.%d.%d version\n", >>>>> PROTOCOL_REV_MAJOR(scpi_info->protocol_version), >>>>> PROTOCOL_REV_MINOR(scpi_info->protocol_version), >>>> >>>> Why not have default value like 0.0 ? Just add a comment. Since get >>>> version is exported out, IMO having default value makes more sense. What >>>> do you think ? >>>> >>>>> @@ -1124,15 +1125,16 @@ err: >>>>> FW_REV_MINOR(scpi_info->firmware_version), >>>>> FW_REV_PATCH(scpi_info->firmware_version)); >>>>> >>>>> + ret = sysfs_create_groups(&dev->kobj, versions_groups); >>>>> + if (ret) >>>>> + dev_err(dev, "unable to create sysfs version group\n"); >>>>> + } >>>>> + >>>> >>>> Again this can stay as is if we have default. >>>> >>> >>> Printing version 0.0 firmware 0.0.0 is a nonsense for me... >>> >> >> OK 0.0 was a wrong example. May be 0.1 ? >> >> Since the driver has already exposed, hypothetically user-space can use >> that information, so IMO, we need to expose some static version for pre-v1.0 >> >> I am surprised that capability is not supported as this was present even >> in that legacy SCPI. Do you know what happens if you send that command ? >> Have you done some experiments on that ? >> > > I've experimented and returns EOPNOTSUPP, Amlogic confirmed to us the command was not implemented. > > This a clearly a corner-case. > OK, thanks for the confirmation. Not exporting anything could be kind of breaking ABI as it was not made optional when introduced :( (you can blame me ;)) -- Regards, Sudeep