mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lars Poeschel <poeschel@lemonage.de>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lars Poeschel <larsi@wh2.tu-dresden.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: viperboard driver added
Date: Fri, 28 Sep 2012 15:59:07 +0200	[thread overview]
Message-ID: <201209281559.08017.poeschel@lemonage.de> (raw)
In-Reply-To: <20120925085559.GL28670@sortiz-mobl>

Hi Samuel,

Am Dienstag, 25. September 2012, 10:55:59 schrieb Samuel Ortiz:
> Hi Lars,
> 
> On Mon, Sep 24, 2012 at 06:46:19PM +0200, Lars Poeschel wrote:
> > Hi Samuel,
> > 
> > Thanks for your review.
> > 
> > Am 19.09.2012 17:29, schrieb Samuel Ortiz:
> > >Hi Lars,
> > >
> > >On Mon, Aug 27, 2012 at 03:08:38PM +0200, larsi@wh2.tu-dresden.de
> > >
> > >wrote:
> > >>From: Lars Poeschel <poeschel@lemonage.de>
> > >>
> > >>First version of the driver for Nano River Tech's
> > >>viperboard added.
> > >>It supports i2c, adc, gpio a and gpio b. spi and pwm on
> > >>the first gpio a pins is not supported yet.
> > >>
> > >>Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
> > >>---
> > >>
> > >> drivers/mfd/Kconfig      |   17 +
> > >> drivers/mfd/Makefile     |    1 +
> > >> drivers/mfd/viperboard.c | 1084
> > >>
> > >>++++++++++++++++++++++++++++++++++++++++++++++
> > >>
> > >> 3 files changed, 1102 insertions(+)
> > >> create mode 100644 drivers/mfd/viperboard.c
> > >
> > >So the MFD driver contains a GPIO one, and an i2c bus driver.
> > >You should really split this code into at least 3 pieces: 1 for
> > >the GPIO
> > >(drivers/gpio), another one for your i2c bus algorithm
> > >(drivers/i2c/busses)
> > >and a last one for the actual MFD driver. Your Kconfig entries
> > >will define the
> > >dependencies between them.
> > >Then you can define your SoC subdevices as MFD cells and use the
> > >MFD APIs to
> > >add them as platform devices.
> > 
> > I am not really sure, but maybe you got mislead by the term
> > "viperboard". It is NOT an embedded evaluation board or starterkit.
> > It is an USB to SPI, I2C, GPIO and ADC interface. You can get a
> > quick overview here: http://nanorivertech.com/viperboard.html
> > The I2C, GPIO or ADC parts of this driver will never be part of a
> > "platform device" in terms of the linux kernel definining the
> > configuration of different embedded evaluation boards (a platform).
> 
> Well, that's something none of us know for sure :)
> We've seen various IPs re-used across several devices in the past, which is
> why we're keen on separating the various drivers.
> Also, from an architectural point of view, it makes more sense and is
> cleaner imho.
> 
> > Do you still think I should split up the different parts into their
> > respective subsystems in the kernel and have one "core" combining
> > those parts in MFD ?
> 
> Yes, I do.
> 
> > If so, I will do this. As there would be multiple different
> > maintainers involved, against which branch has my patch to be ?
> 
> Most of your sub devices (GPIO, I2C, ADC) will be depending on the MFD one
> (as in Kconfig dependency), so it's safe to send each driver to the
> specific sub system maintainer and expect him/her to take it. We usually
> figure that out once the patchset is ready for upstream inclusion.
> 
> > Should I simply CC the patch to all involved maintainers ?
> 
> It's better yes. Even though a maintainer typically cares about 1 or 2
> patches out of the whole patchset, they usually prefer to be able to get
> the whole picture and understand where you want to go with this
> submission.

I have done it, and it works! :-) And it looks indeed much cleaner now. But I 
have on problem left:
I can not rmmod the "core" module. I get an kernel oops stacktrace origination 
from mfd_remove_devices_fn. I think the problem is as follows:
Since my viperboard is an usb device, I write a struct usb_driver, that's 
probe function is called with struct usb_interface containing the struct 
device that I pass as parent device to mfd_add_devices.
During disconnect function I pass the same parent device to mfd_remove_devices 
for removal of mfd_cells. In mfd_remove_devices_fn the pointer is then 
containter_of 'd to struct platform_device and to struct usb_interface (struct 
usb_interface is not containing a mfd_cell pointer either), which then 
obviously accesses wrong memory in platform_device_unregister.
I am a bit confused now. Is the mfd_cell mechanism only working with 
platform_devices ?
What should I do ?
I think I have to options:
1. Extending mfd-core to have functions to work with usb_interface and add an 
mfd_cell to it.
2. Constructing some dummy platform_device in my core driver and passing this 
to mfd_add_devices and mfd_remove_devices to satisfy them. But this seems a 
bit ugly to me.

Or am I doing something completly wrong ?

Thanks for your help,
Lars

  reply	other threads:[~2012-09-28 14:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 13:08 larsi
2012-09-19 15:29 ` Samuel Ortiz
2012-09-24 16:46   ` Lars Poeschel
2012-09-25  8:55     ` Samuel Ortiz
2012-09-28 13:59       ` Lars Poeschel [this message]
2012-10-12 14:34       ` [PATCH v2 1/4] mfd: add viperboard driver Lars Poeschel
2012-10-12 14:34         ` [PATCH v2 2/4] gpio: add viperboard gpio driver Lars Poeschel
2012-10-15 13:00           ` Linus Walleij
2012-10-16  6:51             ` Lars Poeschel
2012-10-16 10:00               ` Linus Walleij
2012-10-16 13:38                 ` Lars Poeschel
2012-10-16 17:11                   ` Linus Walleij
2012-10-23 15:24                     ` Lars Poeschel
2012-10-24  7:53                       ` Linus Walleij
2012-10-24 16:31                         ` Mark Brown
2012-10-25 10:02                           ` Lars Poeschel
2012-10-25 14:00                             ` Mark Brown
2012-10-25 16:02                               ` Lars Poeschel
2012-10-25 16:06                                 ` Mark Brown
2012-10-26  9:16                                   ` Lars Poeschel
2012-10-27 16:14                                     ` Linus Walleij
2012-10-27 21:35                                       ` Mark Brown
2012-10-12 14:34         ` [PATCH v2 3/4] i2c: add viperboard i2c master driver Lars Poeschel
2012-10-12 14:34         ` [PATCH v2 4/4] iio: adc: add viperboard adc driver Lars Poeschel
2012-10-15 14:26           ` Lars-Peter Clausen
2012-10-16  7:11             ` Lars Poeschel
2012-10-15 17:09         ` [PATCH v2 1/4] mfd: add viperboard driver Peter Meerwald
2012-10-16  7:15           ` Lars Poeschel
2012-10-16  8:40         ` Lars-Peter Clausen
2012-10-16  9:43           ` Lars Poeschel
2012-10-16 10:58             ` Lars-Peter Clausen
2012-10-18  7:29               ` Lars Poeschel
2012-10-18 14:13                 ` Lars-Peter Clausen

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=201209281559.08017.poeschel@lemonage.de \
    --to=poeschel@lemonage.de \
    --cc=larsi@wh2.tu-dresden.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /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

Powered by JetHome