Skip to content

Commit 71b200b

Browse files
fancerdavem330
authored andcommitted
net: pcs: xpcs: Convert xpcs_id to dw_xpcs_desc
A structure with the PCS/PMA MMD IDs data is being introduced in one of the next commits. In order to prevent the names ambiguity let's convert the xpcs_id structure name to dw_xpcs_desc. The later version is more suitable since the structure content is indeed the device descriptor containing the data and callbacks required for the driver to correctly set the device up. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 03b3be0 commit 71b200b

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,19 @@ struct xpcs_compat {
151151
int (*pma_config)(struct dw_xpcs *xpcs);
152152
};
153153

154-
struct xpcs_id {
154+
struct dw_xpcs_desc {
155155
u32 id;
156156
u32 mask;
157157
const struct xpcs_compat *compat;
158158
};
159159

160-
static const struct xpcs_compat *xpcs_find_compat(const struct xpcs_id *id,
161-
phy_interface_t interface)
160+
static const struct xpcs_compat *
161+
xpcs_find_compat(const struct dw_xpcs_desc *desc, phy_interface_t interface)
162162
{
163163
int i, j;
164164

165165
for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
166-
const struct xpcs_compat *compat = &id->compat[i];
166+
const struct xpcs_compat *compat = &desc->compat[i];
167167

168168
for (j = 0; j < compat->num_interfaces; j++)
169169
if (compat->interface[j] == interface)
@@ -177,7 +177,7 @@ int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
177177
{
178178
const struct xpcs_compat *compat;
179179

180-
compat = xpcs_find_compat(xpcs->id, interface);
180+
compat = xpcs_find_compat(xpcs->desc, interface);
181181
if (!compat)
182182
return -ENODEV;
183183

@@ -612,7 +612,7 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
612612
int i;
613613

614614
xpcs = phylink_pcs_to_xpcs(pcs);
615-
compat = xpcs_find_compat(xpcs->id, state->interface);
615+
compat = xpcs_find_compat(xpcs->desc, state->interface);
616616
if (!compat)
617617
return -EINVAL;
618618

@@ -633,7 +633,7 @@ void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
633633
int i, j;
634634

635635
for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
636-
const struct xpcs_compat *compat = &xpcs->id->compat[i];
636+
const struct xpcs_compat *compat = &xpcs->desc->compat[i];
637637

638638
for (j = 0; j < compat->num_interfaces; j++)
639639
__set_bit(compat->interface[j], interfaces);
@@ -853,7 +853,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
853853
const struct xpcs_compat *compat;
854854
int ret;
855855

856-
compat = xpcs_find_compat(xpcs->id, interface);
856+
compat = xpcs_find_compat(xpcs->desc, interface);
857857
if (!compat)
858858
return -ENODEV;
859859

@@ -1118,7 +1118,7 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
11181118
const struct xpcs_compat *compat;
11191119
int ret;
11201120

1121-
compat = xpcs_find_compat(xpcs->id, state->interface);
1121+
compat = xpcs_find_compat(xpcs->desc, state->interface);
11221122
if (!compat)
11231123
return;
11241124

@@ -1341,7 +1341,7 @@ static const struct xpcs_compat nxp_sja1110_xpcs_compat[DW_XPCS_INTERFACE_MAX] =
13411341
},
13421342
};
13431343

1344-
static const struct xpcs_id xpcs_id_list[] = {
1344+
static const struct dw_xpcs_desc xpcs_desc_list[] = {
13451345
{
13461346
.id = DW_XPCS_ID,
13471347
.mask = DW_XPCS_ID_MASK,
@@ -1395,18 +1395,18 @@ static int xpcs_init_id(struct dw_xpcs *xpcs)
13951395

13961396
xpcs_id = xpcs_get_id(xpcs);
13971397

1398-
for (i = 0; i < ARRAY_SIZE(xpcs_id_list); i++) {
1399-
const struct xpcs_id *entry = &xpcs_id_list[i];
1398+
for (i = 0; i < ARRAY_SIZE(xpcs_desc_list); i++) {
1399+
const struct dw_xpcs_desc *desc = &xpcs_desc_list[i];
14001400

1401-
if ((xpcs_id & entry->mask) != entry->id)
1401+
if ((xpcs_id & desc->mask) != desc->id)
14021402
continue;
14031403

1404-
xpcs->id = entry;
1404+
xpcs->desc = desc;
14051405

14061406
break;
14071407
}
14081408

1409-
if (!xpcs->id)
1409+
if (!xpcs->desc)
14101410
return -ENODEV;
14111411

14121412
ret = xpcs_dev_flag(xpcs);
@@ -1420,7 +1420,7 @@ static int xpcs_init_iface(struct dw_xpcs *xpcs, phy_interface_t interface)
14201420
{
14211421
const struct xpcs_compat *compat;
14221422

1423-
compat = xpcs_find_compat(xpcs->id, interface);
1423+
compat = xpcs_find_compat(xpcs->desc, interface);
14241424
if (!compat)
14251425
return -EINVAL;
14261426

include/linux/pcs/pcs-xpcs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
/* dev_flag */
2929
#define DW_DEV_TXGBE BIT(0)
3030

31-
struct xpcs_id;
31+
struct dw_xpcs_desc;
3232

3333
struct dw_xpcs {
34+
const struct dw_xpcs_desc *desc;
3435
struct mdio_device *mdiodev;
35-
const struct xpcs_id *id;
3636
struct phylink_pcs pcs;
3737
phy_interface_t interface;
3838
int dev_flag;

0 commit comments

Comments
 (0)