diff mbox series

[RFC,2/5] net: dsa: mv88e6xxx: rename smi read/write functions

Message ID 20190501193126.19196-3-rasmus.villemoes@prevas.dk
State RFC
Delegated to: David Miller
Headers show
Series net: dsa: POC support for mv88e6250 | expand

Commit Message

Rasmus Villemoes May 1, 2019, 7:32 p.m. UTC
With the previous patch adding support for two chips using direct SMI
addressing, the smi_single_chip_{read,write} functions are slightly
misnamed. Changing to smi_dual_chip_{read,write} would not be accurate
either.

Change the names to reflect how the access to the SMI registers is
done (direct/indirect) rather than the number of chips that can be
connected to the same SMI master. No functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 42 ++++++++++++++++----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

Comments

Vivien Didelot May 3, 2019, 9:57 p.m. UTC | #1
Hi Rasmus,

On Wed, 1 May 2019 19:32:11 +0000, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:

> -static int mv88e6xxx_smi_single_chip_read(struct mv88e6xxx_chip *chip,
> -					  int addr, int reg, u16 *val)
> +static int mv88e6xxx_smi_direct_read(struct mv88e6xxx_chip *chip,
> +				     int addr, int reg, u16 *val)

I have a preparatory patch which does almost exactly that. I'm sending it
to simplify this patchset.

Also please use my Gmail address as described by get_maintainer.pl please.

Thank you,
Vivien
Rasmus Villemoes May 6, 2019, 5:57 a.m. UTC | #2
On 03/05/2019 23.57, Vivien Didelot wrote:
> Hi Rasmus,
> 
> On Wed, 1 May 2019 19:32:11 +0000, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
> 
>> -static int mv88e6xxx_smi_single_chip_read(struct mv88e6xxx_chip *chip,
>> -					  int addr, int reg, u16 *val)
>> +static int mv88e6xxx_smi_direct_read(struct mv88e6xxx_chip *chip,
>> +				     int addr, int reg, u16 *val)
> 
> I have a preparatory patch which does almost exactly that. I'm sending it
> to simplify this patchset.

OK, I'll hold off sending a v2 until I see how 1/5 and 2/5 are obsoleted
by your patch(es).

> Also please use my Gmail address as described by get_maintainer.pl please.

Sorry, I must have been running 'git send-email' (which invokes
get_maintainer via a --to-cmd script) from the 4.19 tree I'm currently
targeting. Will try to remember.

Thanks,
Rasmus
Vivien Didelot May 6, 2019, 2:51 p.m. UTC | #3
Hi Rasmus,

On Mon, 6 May 2019 05:57:11 +0000, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:

> > I have a preparatory patch which does almost exactly that. I'm sending it
> > to simplify this patchset.
> 
> OK, I'll hold off sending a v2 until I see how 1/5 and 2/5 are obsoleted
> by your patch(es).

You may rebase your patches now and add your new implementation of
register access through SMI in the smi.c file if that is necessary.


Thanks,

	Vivien
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index f66daa77774b..d8d8230a6bf5 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -86,8 +86,8 @@  static int mv88e6xxx_smi_write(struct mv88e6xxx_chip *chip,
 	return chip->smi_ops->write(chip, addr, reg, val);
 }
 
-static int mv88e6xxx_smi_single_chip_read(struct mv88e6xxx_chip *chip,
-					  int addr, int reg, u16 *val)
+static int mv88e6xxx_smi_direct_read(struct mv88e6xxx_chip *chip,
+				     int addr, int reg, u16 *val)
 {
 	int ret;
 
@@ -100,8 +100,8 @@  static int mv88e6xxx_smi_single_chip_read(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
-static int mv88e6xxx_smi_single_chip_write(struct mv88e6xxx_chip *chip,
-					   int addr, int reg, u16 val)
+static int mv88e6xxx_smi_direct_write(struct mv88e6xxx_chip *chip,
+				      int addr, int reg, u16 val)
 {
 	int ret;
 
@@ -112,12 +112,12 @@  static int mv88e6xxx_smi_single_chip_write(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
-static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_single_chip_ops = {
-	.read = mv88e6xxx_smi_single_chip_read,
-	.write = mv88e6xxx_smi_single_chip_write,
+static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_direct_ops = {
+	.read = mv88e6xxx_smi_direct_read,
+	.write = mv88e6xxx_smi_direct_write,
 };
 
-static int mv88e6xxx_smi_multi_chip_wait(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_smi_indirect_wait(struct mv88e6xxx_chip *chip)
 {
 	int ret;
 	int i;
@@ -134,13 +134,13 @@  static int mv88e6xxx_smi_multi_chip_wait(struct mv88e6xxx_chip *chip)
 	return -ETIMEDOUT;
 }
 
-static int mv88e6xxx_smi_multi_chip_read(struct mv88e6xxx_chip *chip,
-					 int addr, int reg, u16 *val)
+static int mv88e6xxx_smi_indirect_read(struct mv88e6xxx_chip *chip,
+				       int addr, int reg, u16 *val)
 {
 	int ret;
 
 	/* Wait for the bus to become free. */
-	ret = mv88e6xxx_smi_multi_chip_wait(chip);
+	ret = mv88e6xxx_smi_indirect_wait(chip);
 	if (ret < 0)
 		return ret;
 
@@ -151,7 +151,7 @@  static int mv88e6xxx_smi_multi_chip_read(struct mv88e6xxx_chip *chip,
 		return ret;
 
 	/* Wait for the read command to complete. */
-	ret = mv88e6xxx_smi_multi_chip_wait(chip);
+	ret = mv88e6xxx_smi_indirect_wait(chip);
 	if (ret < 0)
 		return ret;
 
@@ -165,13 +165,13 @@  static int mv88e6xxx_smi_multi_chip_read(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
-static int mv88e6xxx_smi_multi_chip_write(struct mv88e6xxx_chip *chip,
-					  int addr, int reg, u16 val)
+static int mv88e6xxx_smi_indirect_write(struct mv88e6xxx_chip *chip,
+					int addr, int reg, u16 val)
 {
 	int ret;
 
 	/* Wait for the bus to become free. */
-	ret = mv88e6xxx_smi_multi_chip_wait(chip);
+	ret = mv88e6xxx_smi_indirect_wait(chip);
 	if (ret < 0)
 		return ret;
 
@@ -187,16 +187,16 @@  static int mv88e6xxx_smi_multi_chip_write(struct mv88e6xxx_chip *chip,
 		return ret;
 
 	/* Wait for the write command to complete. */
-	ret = mv88e6xxx_smi_multi_chip_wait(chip);
+	ret = mv88e6xxx_smi_indirect_wait(chip);
 	if (ret < 0)
 		return ret;
 
 	return 0;
 }
 
-static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_multi_chip_ops = {
-	.read = mv88e6xxx_smi_multi_chip_read,
-	.write = mv88e6xxx_smi_multi_chip_write,
+static const struct mv88e6xxx_bus_ops mv88e6xxx_smi_indirect_ops = {
+	.read = mv88e6xxx_smi_indirect_read,
+	.write = mv88e6xxx_smi_indirect_write,
 };
 
 int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val)
@@ -4553,9 +4553,9 @@  static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
 			      struct mii_bus *bus, int sw_addr)
 {
 	if (sw_addr == 0 || chip->info->dual_chip)
-		chip->smi_ops = &mv88e6xxx_smi_single_chip_ops;
+		chip->smi_ops = &mv88e6xxx_smi_direct_ops;
 	else if (chip->info->multi_chip)
-		chip->smi_ops = &mv88e6xxx_smi_multi_chip_ops;
+		chip->smi_ops = &mv88e6xxx_smi_indirect_ops;
 	else
 		return -EINVAL;