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


Groups > linux.kernel > #1379760

Re: [PATCH v6 01/24] i2c-mux: add common data for every i2c-mux instance

From Wolfram Sang <wsa@the-dreams.de>
Newsgroups linux.kernel
Subject Re: [PATCH v6 01/24] i2c-mux: add common data for every i2c-mux instance
Date 2016-04-15 13:30 +0200
Message-ID <roa6K-2aO-15@gated-at.bofh.it> (permalink)
References <rjM30-Ns-3@gated-at.bofh.it> <rjM32-Ns-45@gated-at.bofh.it> <rmQWu-3to-1@gated-at.bofh.it> <rntbs-1Uv-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

> > I'd suggest to rename 'adapters' into 'num_adapters' throughout this
> > patch. I think it makes the code a lot easier to understand.
> 
> Hmm, you mean just the variable names, right? And not function names
> such as i2c_mux_reserve_(num_)adapters?

Yes, only variable names.

> > Despite that I wonder why not using some of the realloc functions, I
> 
> When I wrote it, I found no devm_ version of realloc. I'm not finding
> anything now either...

Right, there is no devm_ version of it :(

> > wonder even more if we couldn't supply num_adapters to i2c_mux_alloc()
> > and reserve the memory statically. i2c busses are not
> > dynamic/hot-pluggable so that should be good enough?
> 
> Yes, that would work, but it would take some restructuring in some of
> the drivers that currently don't know how many child adapters they
> are going to need when they call i2c_mux_alloc.

Which ones?

> Because you thought about removing i2c_mux_reserve_adapters completely,
> and not provide any means of adding more adapters than specified in
> the i2c_mux_alloc call, right?

Yes. I assumed I2C to be static enough that such information is known in
advance.

> > Ignoring the 80 char limit here makes the code more readable.
> 
> That is only true if you actually have more than 80 characters, so I don't
> agree. Are you adamant about it? (I'm not)

No. Keep it if you prefer it.

> >> +EXPORT_SYMBOL_GPL(i2c_mux_one_adapter);
> > 
> > Are you sure the above function pays off? Its argument list is very
> > complex and it doesn't save a lot of code. Having seperate calls is
> > probably more understandable in drivers? Then again, I assume it makes
> > the conversion of existing drivers easier.
> 
> I added it in v4, you can check earlier versions if you like. Without
> it most gate-muxes (i.e. typically the muxes in drivers/media) grew
> since the i2c_add_mux_adapter call got replaced by two calls, i.e.
> i2c_mux_alloc followed by i2c_max_add_adapter, and coupled with
> error checks made it look more complex than before. So, this wasn't
> much of a cleanup from the point of those drivers.

Hmm, v3 didn't have the driver patches posted with it. Can you push it
to your branch? I am also not too strong with this one, but having a
look how it looks without would be nice.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v6 01/24] i2c-mux: add common data for every i2c-mux instance Peter Rosin <peda@lysator.liu.se> - 2016-04-03 11:00 +0200
  Re: [PATCH v6 01/24] i2c-mux: add common data for every i2c-mux  instance Wolfram Sang <wsa@the-dreams.de> - 2016-04-11 22:50 +0200
    Re: [PATCH v6 01/24] i2c-mux: add common data for every i2c-mux  instance Peter Rosin <peda@lysator.liu.se> - 2016-04-13 15:40 +0200
      Re: [PATCH v6 01/24] i2c-mux: add common data for every i2c-mux  instance Wolfram Sang <wsa@the-dreams.de> - 2016-04-15 13:30 +0200

csiph-web