linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Cc: linux-serial@vger.kernel.org,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>, Rob Herring <robh@kernel.org>,
	Peter Rosin <peda@axentia.se>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-i2c@vger.kernel.org
Subject: Re: [RFC v2 5/6] max9260: add driver for i2c over GMSL passthrough
Date: Wed, 16 Aug 2017 16:30:21 +0300	[thread overview]
Message-ID: <4684645.VU2D5N6UUJ@avalon> (raw)
In-Reply-To: <CAO3366zyKbiEv0vUsbXtZN6HXwzJrr1GQA_d6f=BCj=9Z+HQpQ@mail.gmail.com>

Hi Ulrich,

On Wednesday 16 Aug 2017 15:23:27 Ulrich Hecht wrote:
> On Mon, Jul 31, 2017 at 1:13 PM, Laurent Pinchart wrote:
> >> +static int max9260_probe(struct serdev_device *serdev)
> >> +{
> >> +     struct max9260_device *dev;
> >> +     struct i2c_adapter *adap;
> >> +     int ret;
> >> +
> >> +     dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> >> +     if (!dev)
> >> +             return -ENOMEM;
> >> +
> >> +     init_waitqueue_head(&dev->rx_wq);
> >> +
> >> +     dev->serdev = serdev;
> >> +     serdev_device_open(serdev);
> >> +     serdev_device_set_drvdata(serdev, dev);
> >> +
> >> +     serdev_device_set_client_ops(serdev, &max9260_serdev_client_ops);
> >> +
> >> +     ret = max9260_setup(dev);
> >> +     if (ret < 0)
> >> +             goto err_free;
> >> +
> >> +     adap = &dev->adap;
> >> +     i2c_set_adapdata(adap, dev);
> >> +
> >> +     adap->owner = THIS_MODULE;
> >> +     adap->algo = &max9260_i2c_algorithm;
> >> +     adap->dev.parent = &serdev->dev;
> >> +     adap->retries = 5;
> >> +     strlcpy(adap->name, dev_name(&serdev->dev), sizeof(adap->name));
> >> +
> >> +     ret = i2c_add_adapter(adap);
> >> +     if (ret < 0)
> >> +             return ret;
> >> +
> >> +     return 0;
> >> +
> >> +err_free:
> > No need for a serdev_device_close() ?
> 
> serdev_device_{open,close}() actually operate on the controller, so
> that would pull the rug from under the other devices connected to that
> controller.

My point is that you call open in the .probe() handler and close in the 
.remove() handler. If open needs to be balanced by close, it seems to me that 
you should also call close in the error path.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2017-08-16 13:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 15:24 [RFC v2 0/6] serdev multiplexing support Ulrich Hecht
2017-07-17 15:24 ` [RFC v2 1/6] mux: include compiler.h from mux/consumer.h Ulrich Hecht
2017-07-31  9:02   ` Peter Rosin
2017-07-31  9:56     ` Ulrich Hecht
2017-07-31 11:22   ` Laurent Pinchart
2017-07-17 15:24 ` [RFC v2 2/6] serdev: add method to set parity Ulrich Hecht
2017-07-18 23:08   ` Rob Herring
2017-07-31 10:55   ` Laurent Pinchart
2017-07-17 15:24 ` [RFC v2 3/6] serdev: add multiplexer support Ulrich Hecht
2017-07-18 23:06   ` Rob Herring
2017-08-16 13:23     ` Ulrich Hecht
2017-07-19  7:22   ` Peter Rosin
2017-07-17 15:24 ` [RFC v2 4/6] serial: core: support deferring serdev controller registration Ulrich Hecht
2017-07-19  3:24   ` Rob Herring
2017-07-17 15:24 ` [RFC v2 5/6] max9260: add driver for i2c over GMSL passthrough Ulrich Hecht
2017-07-18  6:51   ` Geert Uytterhoeven
2017-07-19 15:00   ` Wolfram Sang
2017-08-16 13:23     ` Ulrich Hecht
2017-08-16 13:32       ` Laurent Pinchart
2017-07-31 11:13   ` Laurent Pinchart
2017-08-16 13:23     ` Ulrich Hecht
2017-08-16 13:30       ` Laurent Pinchart [this message]
2017-07-17 15:24 ` [RFC v2 6/6] ARM: dts: blanche: add SCIF1 and MAX9260 deserializer Ulrich Hecht
2017-07-18  6:52   ` Geert Uytterhoeven
2017-07-31 11:20   ` Laurent Pinchart
2017-07-18 23:14 ` [RFC v2 0/6] serdev multiplexing support Rob Herring

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=4684645.VU2D5N6UUJ@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=peda@axentia.se \
    --cc=robh@kernel.org \
    --cc=ulrich.hecht+renesas@gmail.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).