Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6140583iog; Thu, 23 Jun 2022 12:11:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ubCLz+LkbolXTp+nIg/gTgNpy3wA06fUYfH64xaAAO4i2qf0mvrFkuB7CR8j58/2xgt54p X-Received: by 2002:a05:6402:1509:b0:435:6e97:2e51 with SMTP id f9-20020a056402150900b004356e972e51mr12668992edw.354.1656011479978; Thu, 23 Jun 2022 12:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011479; cv=none; d=google.com; s=arc-20160816; b=pkSTNG3UUSCwRLkCjh4e2BHCoUqTxsH+csTyroUx5HVNILynV2wtd+y6iDVFKIrZHy tq5VtFSHnclG3RDV/69D2akH95Pa9Zdpx8a4MR6tx52ssm2BGwMrMp5L3KhZ1TRtC296 TWTuO2BvSBcr0zqQi9YszdLwy165WAEcywX7h7tpDxiyseXYUQ5v5kpXwsbxOkyph4Fw zeIHlR/BcL50mZDYTWOa8XasQ6HHZYQYkGXxN08Y0KV0GvKA9EJdYQZbTcKFDRXl4xtI fgmXJezPRVPtHFyQmv8qmnsd8EjACU/tHT2gElkBay9Jxdk3eWisHf3j+XBtjuPPEX0/ wM3A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QZcNEkKWdDH1laDWXvLJmgWQ7HuvKQLhedwaRDpiH2Y=; b=EUcop4tfivED8kyRlQnTaEXb+nTqg4+EFKMb14HoH1KkWUBL3B42g+PxVAv7sojnjg YhUP1AUjwE+ddYpffY24b0euYi8lAoMLqayQ+7sOxjUqKNP+MsFD+L8YiSCAfgVJArLH 0EyOFgdwKWmB9GGp2Fu2G41Q5M5sVBbiwKa/ptitD9srU+cjMpvjMGVLT1mZA0xHnMc1 bgn/6pAVM2wOqwr+ipxJv86bHmAvbHfbqtHLaebsHLEqgfnHYkdhKM2kFCM+a4QlC2+e uL4z3v4KahgIVpFs6YVlMAZgLGk+/83hBfaGT/mM1v8+mKt3R4dOJmv56vREljF/0ex/ p/TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nFF8D0fy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a17090699c400b00722f4502e2csi972718ejn.631.2022.06.23.12.10.54; Thu, 23 Jun 2022 12:11:19 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nFF8D0fy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237154AbiFWSWI (ORCPT + 99 others); Thu, 23 Jun 2022 14:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237112AbiFWSRu (ORCPT ); Thu, 23 Jun 2022 14:17:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82ADC90FAE; Thu, 23 Jun 2022 10:24:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C4A5961EE4; Thu, 23 Jun 2022 17:24:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C272C3411B; Thu, 23 Jun 2022 17:24:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005048; bh=hwkrbHnCtvH6nIINj4A0OhGpE7zKtFJU1t5z8pm6fgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFF8D0fyzSBrwulCj0aeuGO04qGY03snZJteozUTkieum7HCmd7lO1jMy32kwZZiA jkwXS+AN2SjqQAz8b8MZPg+2Dn9C6yAbN3Vao4IX/KCZrd29JIi+Ah840Rvn8mYKFM gXr0jK+304P6A+tPNbICZnec5Wo5FKVhzjgVgAzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Haller , Guenter Roeck , Sasha Levin Subject: [PATCH 4.19 234/234] Revert "hwmon: Make chip parameter for with_info API mandatory" Date: Thu, 23 Jun 2022 18:45:01 +0200 Message-Id: <20220623164349.672300622@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Greg Kroah-Hartman This reverts commit 1ec0bc72f5dab3ab367ae5230cf6f212d805a225 which is commit ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5 upstream. It should not have been applied to the stable trees. Link: https://lore.kernel.org/r/20220622154454.GA1864037@roeck-us.net Reported-by: Julian Haller Reported-by: Guenter Roeck Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- Documentation/hwmon/hwmon-kernel-api.txt | 2 +- drivers/hwmon/hwmon.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) --- a/Documentation/hwmon/hwmon-kernel-api.txt +++ b/Documentation/hwmon/hwmon-kernel-api.txt @@ -71,7 +71,7 @@ hwmon_device_register_with_info is the m to register a hardware monitoring device. It creates the standard sysfs attributes in the hardware monitoring core, letting the driver focus on reading from and writing to the chip instead of having to bother with sysfs attributes. -The parent device parameter as well as the chip parameter must not be NULL. Its +The parent device parameter cannot be NULL with non-NULL chip info. Its parameters are described in more detail below. devm_hwmon_device_register_with_info is similar to --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -695,12 +695,11 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_ /** * hwmon_device_register_with_info - register w/ hwmon - * @dev: the parent device (mandatory) - * @name: hwmon name attribute (mandatory) - * @drvdata: driver data to attach to created device (optional) - * @chip: pointer to hwmon chip information (mandatory) + * @dev: the parent device + * @name: hwmon name attribute + * @drvdata: driver data to attach to created device + * @chip: pointer to hwmon chip information * @extra_groups: pointer to list of additional non-standard attribute groups - * (optional) * * hwmon_device_unregister() must be called when the device is no * longer needed. @@ -713,10 +712,13 @@ hwmon_device_register_with_info(struct d const struct hwmon_chip_info *chip, const struct attribute_group **extra_groups) { - if (!dev || !name || !chip) + if (!name) return ERR_PTR(-EINVAL); - if (!chip->ops || !chip->ops->is_visible || !chip->info) + if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info)) + return ERR_PTR(-EINVAL); + + if (chip && !dev) return ERR_PTR(-EINVAL); return __hwmon_device_register(dev, name, drvdata, chip, extra_groups);