Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741629 > unrolled thread

Re: [PATCH RFC 3/5] Add KSZ8795 switch driver

Started byPavel Machek <pavel@ucw.cz>
First post2017-09-28 17:30 +0200
Last post2017-10-01 09:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RFC 3/5] Add KSZ8795 switch driver Pavel Machek <pavel@ucw.cz> - 2017-09-28 17:30 +0200
    RE: [PATCH RFC 3/5] Add KSZ8795 switch driver <Tristram.Ha@microchip.com> - 2017-09-29 20:50 +0200
      Re: [PATCH RFC 3/5] Add KSZ8795 switch driver Pavel Machek <pavel@ucw.cz> - 2017-10-01 09:30 +0200

#1741629 — Re: [PATCH RFC 3/5] Add KSZ8795 switch driver

FromPavel Machek <pavel@ucw.cz>
Date2017-09-28 17:30 +0200
SubjectRe: [PATCH RFC 3/5] Add KSZ8795 switch driver
Message-ID<uuIVc-2ep-15@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

> > > > Similar code will be needed by other drivers, right?
> > >
> > > Although KSZ8795 and KSZ8895 may use the same code, the other
> > > chips will have different code.
> > 
> > Ok, please make sure code is shared between these two.
> 
> The exact function probably cannot be shared between KSZ8795
> and KSZ8895 drivers because although the register constants look
> the same but their exact locations are different in the 2 chips.

Put the code into header as static inline and include it from both
places?

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [next] | [standalone]


#1742279

From<Tristram.Ha@microchip.com>
Date2017-09-29 20:50 +0200
Message-ID<uv8wh-1rx-17@gated-at.bofh.it>
In reply to#1741629
> > > > > Similar code will be needed by other drivers, right?
> > > >
> > > > Although KSZ8795 and KSZ8895 may use the same code, the other
> > > > chips will have different code.
> > >
> > > Ok, please make sure code is shared between these two.
> >
> > The exact function probably cannot be shared between KSZ8795
> > and KSZ8895 drivers because although the register constants look
> > the same but their exact locations are different in the 2 chips.
> 
> Put the code into header as static inline and include it from both
> places?
> 

Although KSZ8795 and KSZ8895 share the same code when simulating
the PHY register access, even though the exact registers are not the
same, this code needs a little modification for another chip.  It also looks
too large to put in a header.

[toc] | [prev] | [next] | [standalone]


#1742741

FromPavel Machek <pavel@ucw.cz>
Date2017-10-01 09:30 +0200
Message-ID<uvGRk-7wg-3@gated-at.bofh.it>
In reply to#1742279

[Multipart message — attachments visible in raw view] — view raw

On Fri 2017-09-29 18:45:19, Tristram.Ha@microchip.com wrote:
> > > > > > Similar code will be needed by other drivers, right?
> > > > >
> > > > > Although KSZ8795 and KSZ8895 may use the same code, the other
> > > > > chips will have different code.
> > > >
> > > > Ok, please make sure code is shared between these two.
> > >
> > > The exact function probably cannot be shared between KSZ8795
> > > and KSZ8895 drivers because although the register constants look
> > > the same but their exact locations are different in the 2 chips.
> > 
> > Put the code into header as static inline and include it from both
> > places?
> 
> Although KSZ8795 and KSZ8895 share the same code when simulating
> the PHY register access, even though the exact registers are not the
> same, this code needs a little modification for another chip.  It also looks
> too large to put in a header.

I believe putting it into a header is prefferable to having two (or
three) copies of the code. If it needs small changes, you can
introduce if () ..., gcc can probably optimize it out.

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web