[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211013161909.735f2f17@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 13 Oct 2021 16:19:09 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net,
Maciej Machnikowski <maciej.machnikowski@...el.com>,
netdev@...r.kernel.org, richardcochran@...il.com,
Sunitha Mekala <sunithax.d.mekala@...el.com>
Subject: Re: [PATCH net-next 3/4] ice: Add support for SMA control
multiplexer
On Tue, 12 Oct 2021 09:31:52 -0700 Tony Nguyen wrote:
> From: Maciej Machnikowski <maciej.machnikowski@...el.com>
>
> E810-T adapters have two external bidirectional SMA connectors and two
> internal unidirectional U.FL connectors. Multiplexing between U.FL and
> SMA and SMA direction is controlled using the PCA9575 expander.
>
> Add support for the PCA9575 detection and control of the respective pins
> of the SMA/U.FL multiplexer using the GPIO AQ API.
> +static int
> +ice_get_pca9575_handle(struct ice_hw *hw, u16 *pca9575_handle)
> +{
> + struct ice_aqc_get_link_topo *cmd;
> + struct ice_aq_desc desc;
> + int status;
> + u8 idx;
> +
> + if (!hw || !pca9575_handle)
> + return -EINVAL;
Looks like purest form of defensive programming, please drop this.
> +bool ice_is_pca9575_present(struct ice_hw *hw)
> +{
> + u16 handle = 0;
> + int status;
> +
> + if (!ice_is_e810t(hw))
> + return false;
> +
> + status = ice_get_pca9575_handle(hw, &handle);
> + if (!status && handle)
> + return true;
> +
> + return false;
> +}
return !status && handle;
Powered by blists - more mailing lists