linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Vadim Pasternak <vadimp@nvidia.com>,
	"wsa@the-dreams.de" <wsa@the-dreams.de>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH i2c-next v2 5/7] i2c: mux: mlxcpld: Extend driver to support word address space devices
Date: Sat, 30 Jan 2021 00:00:26 +0100	[thread overview]
Message-ID: <67fb2f56-cac7-e466-c6a1-c46dab76b112@axentia.se> (raw)
In-Reply-To: <DM6PR12MB38987A5C2B8A8429289BA6CDAFBA9@DM6PR12MB3898.namprd12.prod.outlook.com>

Hi Vadim,

On 2021-01-28 20:29, Vadim Pasternak wrote:
> Hi Peter,
> 

*snip*

> I can merge 5 and 6 to one patch.
> Would it be OK?

Please no, that's backwards.

> I would like to not drop one-byte register support.
> We have InfiniBand modular system with leaves and spines devices on which
> I need one-byte case. Code for those device was not upstream-ed yet.

If you could have dropped the one-byte code, you'd have had a lot more
freedom. If that support has to remain, then I have to assume that it
should be preserved. So, you need to make it as clear as possible that
the one-byte code still works as before. The current series makes this
hard to see. I have to read patches out of order, which should not be
needed.

Look, when you add a new driver the most important thing to look out for
is that the new code isn't adding bad interfaces or doing stupid things
like double free etc. If the hardware works or not is not really important.
If it doesn't work, nothing is lost because it didn't work before either.
But when you extend a driver to support new hardware, you need to make it
clear that the old hardware keeps working. In my experience, the best way
to do that is to, if needed, first make the existing code more flexible
but without adding any support for new hardware. I.e. first prepare the
driver. Then, when the code is in such a shape that adding the support for
the new hardware is easy, that final patch will be as easy to take for the
maintainer as a completely new driver would be.

The difficulty will always be in the preparatory patches that make the
driver more flexible while preserving the old functionality.

In this case, you have a couple of issus that you need to address before
you can add support for your new hardware.

One issue is that the one-byte code is never writing regval 0 to the
register. It is instead using that value as a hint to not short out the
*next* write of the regval. You seem to need your new two-byte code to
be able to program regval 0 to the mux register. I would solve this by
changing the 0 key to some other number, probably -1, so that the same
mechanism could be used in both cases. For that to happen last_chan
needs to be able to hold -1, so it needs to change type from u8. This
change should be done in one patch, before adding the two-byte support.
Then this issue becomes a non-issue when adding the two-byte support,
because the driver already fits the need.

One issue is that the current mechanism for selecting the actual regval
to program is inflexible; you want to be able to not create all
the child adapters, only the ones you actually need. I.e. the change from
adap_id to chan_id. That change should be done in a preparatory patch,
before adding two-byte support.

One issue is that the driver hardcodes 8 maximum child adapters, and you
need to make that more flexible. Do that change before you add two-byte
support. That could possibly be in the same patch as the above adap_id
to chan_id change, but it would not be wrong to do it as separate steps.
As a reviewer I would probably prefer it in a separate patch.

Etc, take small steps and do one logical change in each patch. That makes
reviewing much more pleasant than reviewing everything mashed together.

Cheers,
Peter

  parent reply	other threads:[~2021-01-29 23:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 19:24 [PATCH i2c-next v2 0/7] i2c: mux: mlxcpld: Extend driver functionality and update licenses Vadim Pasternak
2021-01-22 19:24 ` [PATCH i2c-next v2 1/7] i2c: mux: mlxcpld: Update module license Vadim Pasternak
2021-01-28 10:09   ` Peter Rosin
2021-02-01 21:56   ` Wolfram Sang
2021-01-22 19:24 ` [PATCH i2c-next v2 2/7] platform/x86: " Vadim Pasternak
2021-01-28 10:10   ` Peter Rosin
2021-02-01 21:56   ` Wolfram Sang
2021-01-22 19:24 ` [PATCH i2c-next v2 3/7] i2c: mux: mlxcpld: Move header file out of x86 realm Vadim Pasternak
2021-01-28 10:11   ` Peter Rosin
2021-02-01 21:56   ` Wolfram Sang
2021-01-22 19:24 ` [PATCH i2c-next v2 4/7] i2c: mux: mlxcpld: Convert driver to platform driver Vadim Pasternak
2021-01-22 19:25 ` [PATCH i2c-next v2 5/7] i2c: mux: mlxcpld: Extend driver to support word address space devices Vadim Pasternak
2021-01-25 21:37   ` Peter Rosin
     [not found]     ` <DM6PR12MB38987A5C2B8A8429289BA6CDAFBA9@DM6PR12MB3898.namprd12.prod.outlook.com>
2021-01-29 23:00       ` Peter Rosin [this message]
2021-01-22 19:25 ` [PATCH i2c-next v2 6/7] i2c: mux: mlxcpld: Extend supported mux number Vadim Pasternak
2021-01-22 19:25 ` [PATCH i2c-next v2 7/7] i2c: mux: mlxcpld: Add callback to notify mux creation completion Vadim Pasternak
2021-01-28  8:53 ` [PATCH i2c-next v2 0/7] i2c: mux: mlxcpld: Extend driver functionality and update licenses Wolfram Sang
2021-01-28 10:14   ` Peter Rosin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67fb2f56-cac7-e466-c6a1-c46dab76b112@axentia.se \
    --to=peda@axentia.se \
    --cc=linux-i2c@vger.kernel.org \
    --cc=vadimp@nvidia.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).