Re: [PATCH net-next] freescale:Remove unnecessary (void*) conversions

From: Horatiu Vultur
Date: Tue May 09 2023 - 06:59:31 EST


The 05/09/2023 18:25, wuych wrote:

Hi wuych,

>
> Pointer variables of void * type do not require type cast.
>
> Signed-off-by: wuych <yunchuan@xxxxxxxxxxxx>
> ---
> drivers/net/ethernet/freescale/xgmac_mdio.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
> index a13b4ba4d6e1..167a7fe04853 100644
> --- a/drivers/net/ethernet/freescale/xgmac_mdio.c
> +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
> @@ -131,7 +131,7 @@ static int xgmac_wait_until_done(struct device *dev,
> static int xgmac_mdio_write_c22(struct mii_bus *bus, int phy_id, int regnum,
> u16 value)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;

Don't forget to use the reverse x-mas notation.
The longer lines should be at top.
The same applies to the other changes that you have done in this patch.

> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> bool endian = priv->is_little_endian;
> u16 dev_addr = regnum & 0x1f;
> @@ -163,7 +163,7 @@ static int xgmac_mdio_write_c22(struct mii_bus *bus, int phy_id, int regnum,
> static int xgmac_mdio_write_c45(struct mii_bus *bus, int phy_id, int dev_addr,
> int regnum, u16 value)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;
> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> bool endian = priv->is_little_endian;
> u32 mdio_ctl, mdio_stat;
> @@ -205,7 +205,7 @@ static int xgmac_mdio_write_c45(struct mii_bus *bus, int phy_id, int dev_addr,
> */
> static int xgmac_mdio_read_c22(struct mii_bus *bus, int phy_id, int regnum)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;
> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> bool endian = priv->is_little_endian;
> u16 dev_addr = regnum & 0x1f;
> @@ -265,7 +265,7 @@ static int xgmac_mdio_read_c22(struct mii_bus *bus, int phy_id, int regnum)
> static int xgmac_mdio_read_c45(struct mii_bus *bus, int phy_id, int dev_addr,
> int regnum)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;
> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> bool endian = priv->is_little_endian;
> u32 mdio_stat, mdio_ctl;
> @@ -326,7 +326,7 @@ static int xgmac_mdio_read_c45(struct mii_bus *bus, int phy_id, int dev_addr,
>
> static int xgmac_mdio_set_mdc_freq(struct mii_bus *bus)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;
> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> struct device *dev = bus->parent;
> u32 mdio_stat, div;
> @@ -355,7 +355,7 @@ static int xgmac_mdio_set_mdc_freq(struct mii_bus *bus)
>
> static void xgmac_mdio_set_suppress_preamble(struct mii_bus *bus)
> {
> - struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;
> + struct mdio_fsl_priv *priv = bus->priv;
> struct tgec_mdio_controller __iomem *regs = priv->mdio_base;
> struct device *dev = bus->parent;
> u32 mdio_stat;
> --
> 2.30.2
>
>

--
/Horatiu