linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Poeschel <poeschel@lemonage.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Lars Poeschel <larsi@wh2.tu-dresden.de>,
	FlorianSchandinat@gmx.de, mathieu.poirier@linaro.org,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video console: add a driver for lcd2s character display
Date: Tue, 20 Nov 2012 15:21:33 +0100	[thread overview]
Message-ID: <201211201521.33726.poeschel@lemonage.de> (raw)
In-Reply-To: <201211201325.57883.arnd@arndb.de>

On Tuesday 20 November 2012 at 14:25:57, Arnd Bergmann wrote:
> On Tuesday 20 November 2012, Lars Poeschel wrote:
> > From: Lars Poeschel <poeschel@lemonage.de>
> > 
> > This driver allows to use a lcd2s 20x4 character display as
> > a linux console output device.
> > 
> > Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
> 
> The driver looks nice overall, but I found two style issues:

Thank you for your feedback.

> > +static int __devinit lcd2s_i2c_probe(struct i2c_client *i2c,
> > +				const struct i2c_device_id *id)
> > +{
> > +	struct lcd2s_data *data;
> > +
> > +	if (!i2c_check_functionality(i2c->adapter,
> > +			I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
> > +		return -EIO;
> > +	data = devm_kzalloc(&i2c->dev, sizeof(struct lcd2s_data), 
GFP_KERNEL);
> > +	if (!data)
> > +		return -ENOMEM;
> > +
> > +	data->i2c = i2c;
> > +	data->consw.owner		= THIS_MODULE;
> > +	data->consw.con_startup		= lcd2s_startup;
> > +	data->consw.con_init		= lcd2s_init;
> > +	data->consw.con_deinit		= lcd2s_deinit;
> > +	data->consw.con_clear		= lcd2s_clear;
> > +	data->consw.con_putc		= lcd2s_putc;
> > +	data->consw.con_putcs		= lcd2s_putcs;
> > +	data->consw.con_cursor		= lcd2s_cursor;
> > +	data->consw.con_scroll		= lcd2s_scroll;
> > +	data->consw.con_bmove		= lcd2s_bmove;
> > +	data->consw.con_switch		= lcd2s_switch;
> > +	data->consw.con_blank		= lcd2s_blank;
> > +	data->consw.con_set_palette	= lcd2s_set_palette;
> > +	data->consw.con_scrolldelta	= lcd2s_scrolldelta;
> > +
> > +	i2c_set_clientdata(i2c, data);
> > +
> > +	take_over_console(&data->consw, LCD2S_FIRST, LCD2S_LAST, 1);
> > +
> > +	return 0;
> > +}
> 
> It's better to define the struct consw as a preinitialized
> 'static const' object, rather than dynamically setting each
> member.

I could not find a place to store the drivers private data inside the struct 
vc_data. I wanted to have the struct consw inside the drivers private data 
(struct lcd2s_data) to be able to container_of to the drivers private data in 
the consw.con_* functions. This makes it possible to use more than one actual 
lcd2s display with the same driver. Otherwise I have to store the struct 
i2c_client somewhere statically and the driver can control only one display 
and has to forbid to be probed a second time. Or am I wrong somewhere ?

Lars

  reply	other threads:[~2012-11-20 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 12:56 [PATCH] video console: add a driver for lcd2s character display Lars Poeschel
2012-11-20 13:25 ` Arnd Bergmann
2012-11-20 14:21   ` Lars Poeschel [this message]
2012-11-20 16:11     ` Arnd Bergmann
2012-11-22  9:33       ` [PATCH v2] " Lars Poeschel

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=201211201521.33726.poeschel@lemonage.de \
    --to=poeschel@lemonage.de \
    --cc=FlorianSchandinat@gmx.de \
    --cc=arnd@arndb.de \
    --cc=larsi@wh2.tu-dresden.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /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).