Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1664461ybz; Thu, 23 Apr 2020 03:24:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKUKo5/miovJ/rkmBD/S55cvJvD3xd66jcP4LRwYR6VaYtHfsvPDz8tKYi4Y7aoLwSy1lf/ X-Received: by 2002:a17:906:f90e:: with SMTP id lc14mr1956909ejb.156.1587637448164; Thu, 23 Apr 2020 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587637448; cv=none; d=google.com; s=arc-20160816; b=qgrnI4ORJn9R6Wbuv9J8T6/TUBKmbpUoLNO/WSoyo6gHaIwOBcUW/PpUjXQeJPOcVA jsS5jujfVhKdQ2Rv0aV0ADsMq+3JI6u2q4lgETb8WGyt4VdLtsU/P/hdsReUOk2plccT z+gz19G0mpTEZDxseqjaVsB05fcY+iEjqDQDgKoHmCthlABbKjNDdlGvpCpAGrMujZ6W ewdKEY0AWGl8YrtJsBWrAwihTilRp8NYzortiAVR5Q+BTLcsRhLiUS43xAiLfASDg9CM ZX7Y9eZMndcANlqfCDAcc0dFRRWFbkdU9RlAcObsQ2thEOr5DpLgJZiBFv1Nt4gGH7es kLVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jJtnFW/MJ1nCflksmUkvWZ3WflwQQKwodxCjPDupG9g=; b=T731qb8k4sBiRwqarkD3kRz+CQdCyJ84B9H1cDhTgdFFeu8YD8rFeqLyJTo5AirWYm uHLUKoAqbazWrp1TWRtAajrhIeu7Dcvh4FLDId+DB0YgsAKtNlUpu87wdvy0L+4zuJs8 rpW5cv24inLBpxYm+ivAYsd8RxzQ3cATX7CVAUES+VMBvfdUoWVmdD2np95jPxpkh13x 7nLnfi/96T5eULxj5saOtlVR3FDTNCVTh/twV7HStLXDHymUhC674lH06Ph+Og2bCNPg u52PbgFI+FY3TMEF5YmCJx+lkxUIM7uhGBFTRohjjESX6ssON6VB9P2en86wggCmQkS5 7ebg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SL+MA9BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si999671eja.226.2020.04.23.03.23.45; Thu, 23 Apr 2020 03:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SL+MA9BT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgDWKVa (ORCPT + 99 others); Thu, 23 Apr 2020 06:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725854AbgDWKVO (ORCPT ); Thu, 23 Apr 2020 06:21:14 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB641C035493; Thu, 23 Apr 2020 03:21:13 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id v2so2171398plp.9; Thu, 23 Apr 2020 03:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jJtnFW/MJ1nCflksmUkvWZ3WflwQQKwodxCjPDupG9g=; b=SL+MA9BTwa7HX9cUn2j5xDITP997LDN3HbD/qjO86/wv5xpXkNgbmjFZ8WZi9YTx78 qgwmKScnBS+z5QiqP+VTwClgd3H2WwlvQUYePUMJZ5mA++HZrfBJzy1PN3lj/8ZLv5Dx IUqdoiAe3EHaIkzmnStrXgVjYV5KfhUQkyMzqiLGbki355Ax1z3SfsoqJT6THn7dg1P/ FEUQZS4Pj2589j2HQnosfG6I0ScwYJYUta04/XZoy5MVEk2weROYwGqByZ8a0aSCwwVz m7We8Z4UOStTP0Qd07pXUSee+CfoTI0kk6CSoKBkTPPJVhcNf7u/oOt77R3oj2hW8CGI XCzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jJtnFW/MJ1nCflksmUkvWZ3WflwQQKwodxCjPDupG9g=; b=mxF7wbJYyd6SZrHzSkVvzbyudda36n0j71Eo6dqjqFNj+1QSain8Y7iJW22DUnF+8U HbzPiXVIiwxDYbRRp6v1cqrKkQTwtT9L28wohwnKTd2XBN9YBXCMhIA7K3tlmlmcRJZ6 GBM65gEXpvokM5Pc+58HWahTsxYC7qpjD/Bd3FwQE1mU4vmybsctVQnUiWIACxBig6uh TVWSbL9SI9h+g9BlEOw9KbSAaifOfkfhD/6HHI4A7JTUAMjgsuj1wRwPquWWxoV/DPRb q1SNhNPGCKqm7g0UQGTLWsMKwTKzuXyOB9y2hHoEzygiZM/RJiOi+DtwI7STBgxA7LFT OkCg== X-Gm-Message-State: AGi0PubwVkdTdXXnylKZ+46XxuBP9mmbGFzYbAev4vCNmFPGdnKuBWjZ OPBr6eNQLMvddLX/RFJ6GTjMUKdC/JnhXmFsFyc= X-Received: by 2002:a17:902:9306:: with SMTP id bc6mr3049629plb.255.1587637273301; Thu, 23 Apr 2020 03:21:13 -0700 (PDT) MIME-Version: 1.0 References: <20200420194405.8281-1-jithu.joseph@intel.com> <20200420194405.8281-2-jithu.joseph@intel.com> In-Reply-To: From: Andy Shevchenko Date: Thu, 23 Apr 2020 13:21:06 +0300 Message-ID: Subject: Re: [PATCH 1/1] platform/x86: Add Slim Bootloader firmware update signaling driver To: Jithu Joseph Cc: Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List , maurice.ma@intel.com, ravi.p.rangarajan@intel.com, sean.v.kelley@intel.com, kuo-lang.tseng@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 23, 2020 at 5:08 AM Jithu Joseph wrote= : ... > > > +static ssize_t firmware_update_request_store(struct device *dev, > > > + struct > > > device_attribute *attr, > > > + const char *buf, > > > size_t count) > > > +{ > > > + bool val; > > > + int ret; > > > + > > > + ret =3D kstrtobool(buf, &val); > > > + if (ret) > > > + return ret; > > > + > > > + ret =3D set_fwu_request(dev, val ? 1 : 0); > > > > Hmm... If you are going to extend this, why not to pass integer > > directly? (And thus take one from user) > > We have also been thinking about extensibility =E2=80=A6 > > So I will modify the code to allow any u32 input by the user to be > passed down via wmi_set_block(), though 0 and 1 will be the only > inputs documented in the ABI today.( Or did you still mean to error > out if the user input is something other than 0 or 1 ?) I think the best approach is to allow to parse integer input (kstrtouint() is good enough) and return -ERANGE for values > 1. Also put a comment before that check why is done like this (some justification that interface may be extended in the future or so), and pass integer value directly to set_fwu_request(). --=20 With Best Regards, Andy Shevchenko