lkml.org 
[lkml]   [2022]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [net-next: PATCH v3 8/8] net: dsa: mv88e6xxx: switch to device_/fwnode_ APIs
On Wed, Jul 27, 2022 at 08:43:21AM +0200, Marcin Wojtas wrote:
> In order to support both DT and ACPI in future, modify the
> mv88e6xx driver code to use device_/fwnode_ equivalent routines.
> No functional change is introduced by this patch.

...

> static int mv88e6xxx_probe(struct mdio_device *mdiodev)
> {
> struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data;

> + struct fwnode_handle *fwnode = dev_fwnode(&mdiodev->dev);

Move this...

> const struct mv88e6xxx_info *compat_info = NULL;
> struct device *dev = &mdiodev->dev;
> - struct device_node *np = dev->of_node;

...here as

struct fwnode_handle *fwnode = dev_fwnode(dev);

> struct mv88e6xxx_chip *chip;
> int port;
> int err;

> + if (fwnode)

Redundant check.

> + compat_info = device_get_match_data(dev);
> + else if (pdata) {
> compat_info = pdata_device_get_match_data(dev);

compat_info - device_get_match_data(dev);
if (!compat_info && pdata)
compat_info = pdata_device_get_match_data(dev);

...

> + if (fwnode)
> + device_property_read_u32(dev, "eeprom-length",
> + &chip->eeprom_len);
> else
> chip->eeprom_len = pdata->eeprom_len;

Can be done w/o conditional

chip->eeprom_len = pdata->eeprom_len;
device_property_read_u32(dev, "eeprom-length", &chip->eeprom_len);

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-07-27 15:39    [W:0.148 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site