Skip to content

Commit

Permalink
staging: dpaa2-ethsw: store version information of the DPSW object
Browse files Browse the repository at this point in the history
Store the major and minor versions of the DPSW object in the ethsw
structure. This will be used in a subsequent patch to make sure some
commands are only called on the appropriate version of object.

Signed-off-by: Ioana Ciornei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
IoanaCiornei authored and gregkh committed Jul 15, 2020
1 parent 03ad6de commit 3b9c702
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/staging/fsl-dpaa2/ethsw/ethsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,9 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
{
struct device *dev = &sw_dev->dev;
struct ethsw_core *ethsw = dev_get_drvdata(dev);
u16 version_major, version_minor, i;
struct dpsw_stp_cfg stp_cfg;
int err;
u16 i;

ethsw->dev_id = sw_dev->obj_desc.id;

Expand All @@ -1388,20 +1388,20 @@ static int ethsw_init(struct fsl_mc_device *sw_dev)
}

err = dpsw_get_api_version(ethsw->mc_io, 0,
&version_major,
&version_minor);
&ethsw->major,
&ethsw->minor);
if (err) {
dev_err(dev, "dpsw_get_api_version err %d\n", err);
goto err_close;
}

/* Minimum supported DPSW version check */
if (version_major < DPSW_MIN_VER_MAJOR ||
(version_major == DPSW_MIN_VER_MAJOR &&
version_minor < DPSW_MIN_VER_MINOR)) {
if (ethsw->major < DPSW_MIN_VER_MAJOR ||
(ethsw->major == DPSW_MIN_VER_MAJOR &&
ethsw->minor < DPSW_MIN_VER_MINOR)) {
dev_err(dev, "DPSW version %d:%d not supported. Use %d.%d or greater.\n",
version_major,
version_minor,
ethsw->major,
ethsw->minor,
DPSW_MIN_VER_MAJOR, DPSW_MIN_VER_MINOR);
err = -ENOTSUPP;
goto err_close;
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/fsl-dpaa2/ethsw/ethsw.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct ethsw_core {
struct fsl_mc_io *mc_io;
u16 dpsw_handle;
struct dpsw_attr sw_attr;
u16 major, minor;
int dev_id;
struct ethsw_port_priv **ports;

Expand Down

0 comments on commit 3b9c702

Please sign in to comment.