Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1920428rwd; Fri, 9 Jun 2023 04:18:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ER1RtOeqtu2haS8MtA+TkdSoPk3Mj4DFFhs1sU+3Z/P4rRHUo+TmkANRX7ilXUiXSzg8x X-Received: by 2002:a05:6358:9f89:b0:129:b8e9:b740 with SMTP id fy9-20020a0563589f8900b00129b8e9b740mr606066rwb.27.1686309515605; Fri, 09 Jun 2023 04:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686309515; cv=none; d=google.com; s=arc-20160816; b=v9Wc01AqwH47XzQxIJiLN8Ep1LCF9UZ6thSZOdg73OWXNwKDfNn6ImWlrfQ0D7wO0x IEQJ7Lk7MFHIxB1JwSxv8DC54Sr8BtUJLeoMPqdUI5sf6juNjRy1sdKU31sVlB0QjD8v 1YXCWc8l/AuDi5MnVSNgSGobLMFcTpQJ+9yoaFHHtvyxdbliWoxziQRtIhedYwaLi4fP IHqLb7W5NUVUwfzzR+tM/c8wopXRJFUYQCrjSV9MVIlMCETROpjMBCrArmfZJAVnh4Uj ySIJDuPQ+QlTT7p3cMLzeFIZJMSw8jRQSqSYrXgmnt17o21zJoAT37PxSVi4edtgpRTN AzIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=oBJmpK0RILVLRSuR1FiBwAqzshpNh/yy8L552UHFY/o=; b=IMIW6ymzFxH98quAeG3VEwMJdcpykU43AwagFHTGfWuVYzKNU6M9VNJhgVfIaDXFBo PdLqMFERM1XPiOFxHxhOopPxAlQ1KCcSkO/LCOrsTBhRjot+f/ED3Vh8pf79xKv8muql 6zJvGcaeO9jUWABefysIzPZ0wVOaG8cGMDSCom6nYMZgaCXxqkWtfjUhf6w1fZrgQ+ts cR8iys8n+11o8i0BaWk2efpaaJucYVzQtatl0gq+7WV3qWoYv5cLwbUAWsnqKlxS99cN TVlA9Ez5lyrpfPvMnt4vehRL8hrsk380vwOVTdvGtLBDWDEWxCMlbCnPo98Btdj3vXaO OCxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b00512fab9493dsi2443357pge.740.2023.06.09.04.18.22; Fri, 09 Jun 2023 04:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238944AbjFILJM convert rfc822-to-8bit (ORCPT + 99 others); Fri, 9 Jun 2023 07:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238911AbjFILJA (ORCPT ); Fri, 9 Jun 2023 07:09:00 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103102113; Fri, 9 Jun 2023 04:08:56 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QcyvV56M1z6GDPW; Fri, 9 Jun 2023 19:06:46 +0800 (CST) Received: from localhost (10.126.170.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 9 Jun 2023 12:08:53 +0100 Date: Fri, 9 Jun 2023 12:08:52 +0100 From: Jonathan Cameron To: "Verma, Vishal L" CC: "Jiang, Dave" , "Schofield, Alison" , "linux-cxl@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Williams, Dan J" , "Weight, Russell H" , "bwidawsk@kernel.org" , "Weiny, Ira" , "dave@stgolabs.net" Subject: Re: [PATCH v2 1/4] cxl: add a firmware update mechanism using the sysfs firmware loader Message-ID: <20230609120852.00003c6c@Huawei.com> In-Reply-To: <298ed811de7148da70609ac2c6ef81f025690620.camel@intel.com> References: <20230602-vv-fw_update-v2-0-e9e5cd5adb44@intel.com> <20230602-vv-fw_update-v2-1-e9e5cd5adb44@intel.com> <20230608154905.00007551@Huawei.com> <6666972e336a6749f24ce3aab7dddad63a796974.camel@intel.com> <298ed811de7148da70609ac2c6ef81f025690620.camel@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.126.170.42] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Jun 2023 20:26:43 +0000 "Verma, Vishal L" wrote: > On Thu, 2023-06-08 at 20:15 +0000, Verma, Vishal L wrote: > > > > > > + > > > > +???????fwl = firmware_upload_register(THIS_MODULE, &cxlmd->dev, > > > > +????????????????????????????????????? dev_name(&cxlmd->dev), > > > > +????????????????????????????????????? &cxl_memdev_fw_ops, cxlds); > > > > +???????if (IS_ERR(fwl)) { > > > > +???????????????dev_err(&cxlmd->dev, "Failed to register firmware loader\n"); > > > > +???????????????return PTR_ERR(fwl); > > > > > > It's called from probe only so could use dev_err_probe() for slight > > > simplification. > > > > From what I can tell, this ends up looking like: > > > > ????????fwl = firmware_upload_register(THIS_MODULE, dev, dev_name(dev), > > ?????????????????????????????????????? &cxl_memdev_fw_ops, cxlds); > > ????????rc = dev_err_probe(dev, PTR_ERR(fwl), > > ?????????????????????????? "Failed to register firmware loader\n"); > > ????????if (rc) > > ????????????????return rc; > > > > Is that what you meant? Happy to make the change if so. > > > > > Actually I can't drop the IS_ERR() check - so unless I'm missing > something, this doesn't look like much of a simplification: > > > if (IS_ERR(fwl)) { > rc = dev_err_probe(dev, PTR_ERR(fwl), > "Failed to register firmware loader\n"); > if (rc) > return rc; > } > Ah. I replied to previous. It's simpler than that as you know rc != 0 as it's IS_ERR(fwl) dev_err_probe() does two helpful things over dev_err() 1. Handles stashing the debug messages for the deferred probe cases (not relevant here but harmless) 2. Returns the variable you pass in as second argument to allow return dev_err_probe() Jonathan