* [PATCH 0/2] staging: vt6655: Reduce similar statements when working with mac addr @ 2022-07-06 19:18 Philipp Hortmann 2022-07-06 19:19 ` [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr Philipp Hortmann 2022-07-06 19:19 ` [PATCH 2/2] staging: vt6655: Use loop in vt6655_mac_read_ether_addr Philipp Hortmann 0 siblings, 2 replies; 6+ messages in thread From: Philipp Hortmann @ 2022-07-06 19:18 UTC (permalink / raw) To: Forest Bond, Greg Kroah-Hartman, Joe Perches, linux-staging, linux-kernel Use loop in vt6655_mac_read_ether_addr and vt6655_mac_write_bssid_addr to avoid multiple similar statements. Tested with vt6655 on mini PCI Module Transferred this patch over wlan connection of vt6655 Philipp Hortmann (2): staging: vt6655: Use loop in vt6655_mac_write_bssid_addr staging: vt6655: Use loop in vt6655_mac_read_ether_addr drivers/staging/vt6655/device_main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.37.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr 2022-07-06 19:18 [PATCH 0/2] staging: vt6655: Reduce similar statements when working with mac addr Philipp Hortmann @ 2022-07-06 19:19 ` Philipp Hortmann 2022-07-08 12:29 ` Greg Kroah-Hartman 2022-07-06 19:19 ` [PATCH 2/2] staging: vt6655: Use loop in vt6655_mac_read_ether_addr Philipp Hortmann 1 sibling, 1 reply; 6+ messages in thread From: Philipp Hortmann @ 2022-07-06 19:19 UTC (permalink / raw) To: Forest Bond, Greg Kroah-Hartman, Joe Perches, linux-staging, linux-kernel Use loop in vt6655_mac_write_bssid_addr to avoid multiple similar statements. Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> --- Code for testing: for (int i = 0; i < 6; i++){ iowrite8(mac_addr[i], iobase + MAC_REG_BSSID0 + i); printk("i = %i\n", i); } Log: [ 2592.189081] i = 0 [ 2592.189083] i = 1 [ 2592.189083] i = 2 [ 2592.189084] i = 3 [ 2592.189084] i = 4 [ 2592.189085] i = 5 --- drivers/staging/vt6655/device_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 298963cbca1d..099f0b95417a 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -192,12 +192,8 @@ device_set_options(struct vnt_private *priv) static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr) { iowrite8(1, iobase + MAC_REG_PAGE1SEL); - iowrite8(mac_addr[0], iobase + MAC_REG_BSSID0); - iowrite8(mac_addr[1], iobase + MAC_REG_BSSID0 + 1); - iowrite8(mac_addr[2], iobase + MAC_REG_BSSID0 + 2); - iowrite8(mac_addr[3], iobase + MAC_REG_BSSID0 + 3); - iowrite8(mac_addr[4], iobase + MAC_REG_BSSID0 + 4); - iowrite8(mac_addr[5], iobase + MAC_REG_BSSID0 + 5); + for (int i = 0; i < 6; i++) + iowrite8(mac_addr[i], iobase + MAC_REG_BSSID0 + i); iowrite8(0, iobase + MAC_REG_PAGE1SEL); } -- 2.37.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr 2022-07-06 19:19 ` [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr Philipp Hortmann @ 2022-07-08 12:29 ` Greg Kroah-Hartman 2022-07-09 4:07 ` Joe Perches 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2022-07-08 12:29 UTC (permalink / raw) To: Philipp Hortmann; +Cc: Forest Bond, Joe Perches, linux-staging, linux-kernel On Wed, Jul 06, 2022 at 09:19:01PM +0200, Philipp Hortmann wrote: > Use loop in vt6655_mac_write_bssid_addr to avoid multiple > similar statements. > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> > --- > Code for testing: > for (int i = 0; i < 6; i++){ > iowrite8(mac_addr[i], iobase + MAC_REG_BSSID0 + i); > printk("i = %i\n", i); > } > > Log: > [ 2592.189081] i = 0 > [ 2592.189083] i = 1 > [ 2592.189083] i = 2 > [ 2592.189084] i = 3 > [ 2592.189084] i = 4 > [ 2592.189085] i = 5 > --- > drivers/staging/vt6655/device_main.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c > index 298963cbca1d..099f0b95417a 100644 > --- a/drivers/staging/vt6655/device_main.c > +++ b/drivers/staging/vt6655/device_main.c > @@ -192,12 +192,8 @@ device_set_options(struct vnt_private *priv) > static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr) > { > iowrite8(1, iobase + MAC_REG_PAGE1SEL); > - iowrite8(mac_addr[0], iobase + MAC_REG_BSSID0); > - iowrite8(mac_addr[1], iobase + MAC_REG_BSSID0 + 1); > - iowrite8(mac_addr[2], iobase + MAC_REG_BSSID0 + 2); > - iowrite8(mac_addr[3], iobase + MAC_REG_BSSID0 + 3); > - iowrite8(mac_addr[4], iobase + MAC_REG_BSSID0 + 4); > - iowrite8(mac_addr[5], iobase + MAC_REG_BSSID0 + 5); > + for (int i = 0; i < 6; i++) Taking advantage of the new compiler level I see, nice :) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr 2022-07-08 12:29 ` Greg Kroah-Hartman @ 2022-07-09 4:07 ` Joe Perches 2022-07-09 7:02 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Joe Perches @ 2022-07-09 4:07 UTC (permalink / raw) To: Greg Kroah-Hartman, Philipp Hortmann Cc: Forest Bond, linux-staging, linux-kernel On Fri, 2022-07-08 at 14:29 +0200, Greg Kroah-Hartman wrote: > On Wed, Jul 06, 2022 at 09:19:01PM +0200, Philipp Hortmann wrote: > > Use loop in vt6655_mac_write_bssid_addr to avoid multiple > > similar statements. [] > > diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c [] > > @@ -192,12 +192,8 @@ device_set_options(struct vnt_private *priv) > > static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr) [] > > + for (int i = 0; i < 6; i++) > > Taking advantage of the new compiler level I see, nice :) Not sure this is altogether a great idea as it may make backporting a bit difficult, but it's already in the kernel in a few places. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr 2022-07-09 4:07 ` Joe Perches @ 2022-07-09 7:02 ` Greg Kroah-Hartman 0 siblings, 0 replies; 6+ messages in thread From: Greg Kroah-Hartman @ 2022-07-09 7:02 UTC (permalink / raw) To: Joe Perches; +Cc: Philipp Hortmann, Forest Bond, linux-staging, linux-kernel On Fri, Jul 08, 2022 at 09:07:43PM -0700, Joe Perches wrote: > On Fri, 2022-07-08 at 14:29 +0200, Greg Kroah-Hartman wrote: > > On Wed, Jul 06, 2022 at 09:19:01PM +0200, Philipp Hortmann wrote: > > > Use loop in vt6655_mac_write_bssid_addr to avoid multiple > > > similar statements. > [] > > > diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c > [] > > > @@ -192,12 +192,8 @@ device_set_options(struct vnt_private *priv) > > > static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr) > [] > > > + for (int i = 0; i < 6; i++) > > > > Taking advantage of the new compiler level I see, nice :) > > Not sure this is altogether a great idea as it may > make backporting a bit difficult, but it's already > in the kernel in a few places. That's for the stable kernels to worry about, don't let that stop new development from happening for that reason please. thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: vt6655: Use loop in vt6655_mac_read_ether_addr 2022-07-06 19:18 [PATCH 0/2] staging: vt6655: Reduce similar statements when working with mac addr Philipp Hortmann 2022-07-06 19:19 ` [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr Philipp Hortmann @ 2022-07-06 19:19 ` Philipp Hortmann 1 sibling, 0 replies; 6+ messages in thread From: Philipp Hortmann @ 2022-07-06 19:19 UTC (permalink / raw) To: Forest Bond, Greg Kroah-Hartman, Joe Perches, linux-staging, linux-kernel Use loop in vt6655_mac_read_ether_addr to avoid multiple similar statements. Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> --- Code for testing: for (int i = 0; i < 6; i++){ mac_addr[i] = ioread8(iobase + MAC_REG_PAR0 + i); printk("i = %i\n", i); } Log: [ 3608.011168] i = 0 [ 3608.011170] i = 1 [ 3608.011172] i = 2 [ 3608.011174] i = 3 [ 3608.011176] i = 4 [ 3608.011178] i = 5 --- drivers/staging/vt6655/device_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 099f0b95417a..19840dddb4bf 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -200,12 +200,8 @@ static void vt6655_mac_write_bssid_addr(void __iomem *iobase, const u8 *mac_addr static void vt6655_mac_read_ether_addr(void __iomem *iobase, u8 *mac_addr) { iowrite8(1, iobase + MAC_REG_PAGE1SEL); - mac_addr[0] = ioread8(iobase + MAC_REG_PAR0); - mac_addr[1] = ioread8(iobase + MAC_REG_PAR0 + 1); - mac_addr[2] = ioread8(iobase + MAC_REG_PAR0 + 2); - mac_addr[3] = ioread8(iobase + MAC_REG_PAR0 + 3); - mac_addr[4] = ioread8(iobase + MAC_REG_PAR0 + 4); - mac_addr[5] = ioread8(iobase + MAC_REG_PAR0 + 5); + for (int i = 0; i < 6; i++) + mac_addr[i] = ioread8(iobase + MAC_REG_PAR0 + i); iowrite8(0, iobase + MAC_REG_PAGE1SEL); } -- 2.37.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-09 7:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-07-06 19:18 [PATCH 0/2] staging: vt6655: Reduce similar statements when working with mac addr Philipp Hortmann 2022-07-06 19:19 ` [PATCH 1/2] staging: vt6655: Use loop in vt6655_mac_write_bssid_addr Philipp Hortmann 2022-07-08 12:29 ` Greg Kroah-Hartman 2022-07-09 4:07 ` Joe Perches 2022-07-09 7:02 ` Greg Kroah-Hartman 2022-07-06 19:19 ` [PATCH 2/2] staging: vt6655: Use loop in vt6655_mac_read_ether_addr Philipp Hortmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox