From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4108AC77B7F for ; Sun, 30 Apr 2023 18:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231327AbjD3SIt (ORCPT ); Sun, 30 Apr 2023 14:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbjD3SIq (ORCPT ); Sun, 30 Apr 2023 14:08:46 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EA52D67; Sun, 30 Apr 2023 11:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=/d/ZEszhW30qZrVlUU36K4Posqf8iHlf+AhyLNI5JVU=; b=hUwmFd+5iBoMxu7Z1eDhqta3Ma F7jqSep2gK5m4EAT/E+cufTc0AwqdeVulJkBNdKX0wv07AyC743PALjYxPoWmww9bd6mfZJkaUJXl MxoflGX0kRi9LlLgDZA3jnkiubiiVAFik1tSIZh1boZWaiH3Yo8FnIcQijj4VRgwoAkk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ptBTP-00BZ1G-3X; Sun, 30 Apr 2023 20:08:35 +0200 Date: Sun, 30 Apr 2023 20:08:35 +0200 From: Andrew Lunn To: Christian Marangi Cc: Jonathan Corbet , Pavel Machek , Lee Jones , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 02/11] leds: add binding to check support for LED hw control Message-ID: <71cde8c3-527d-4072-a05f-a463c5d3bf43@lunn.ch> References: <20230427001541.18704-1-ansuelsmth@gmail.com> <20230427001541.18704-3-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230427001541.18704-3-ansuelsmth@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + /* > + * Check if the LED driver supports the requested mode provided by the > + * defined supported trigger to setup the LED to hw control mode. > + */ > + int (*hw_control_is_supported)(struct led_classdev *led_cdev, > + unsigned long flags); Hi Christian This needs better documentation. What is the expected return value? My initial implementation for the Marvell driver did not work. I returned -EINVAL if it was not supported and some value >= 0 if it was supported. And most times, it was > 0, not 0. However, when i look at the trigger code: /* Check if the requested mode is supported */ ret = led_cdev->hw_control_is_supported(led_cdev, hw_mode); if (ret) return ret; *can_use_hw_control = true; Anything other than 0 means it is not supported. Andrew