On Tue, Dec 05, 2017 at 05:47:14PM -0800, tristram...@microchip.com wrote: > +static int ksz9477_get_tag(u8 *tag, int *port) > +{ > + *port = tag[0] & 7; > + return KSZ_EGRESS_TAG_LEN; > +} > + > +static void ksz9477_set_tag(void *ptr, u8 *addr, int p) > +{ > + u16 *tag = (u16 *)ptr; > + > + *tag = 1 << p; > + *tag = cpu_to_be16(*tag); > +}
Hi Tristram It would be more normal to create an ops structure struct ksz_tag_ops { int (*get_tag)(u8 *tag, int *port); void (*set_tag)(void *ptr, u8 *addr, int p) }; static const struct ksz_tag_ops ksz9477_tag_ops = { .get_tag = ksz9477_get_tag, .set_tag = ksz9477_set_tag, } and then pass this to the functions. It might even be possible to make this more generic, use it for other tag drivers. Andrew