linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander Shiyan" <shc_work@mail.ru>
To: "Dong Aisheng" <b29396@freescale.com>
Cc: linux-kernel@vger.kernel.org,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Mark Brown" <broonie@opensource.wolfsonmicro.com>,
	"Dong Aisheng" <dong.aisheng@linaro.org>
Subject: Re[2]: [PATCH] mfd: syscon: Added support for using platform driver resources
Date: Thu, 07 Feb 2013 12:41:34 +0400	[thread overview]
Message-ID: <1360226494.178606955@f137.mail.ru> (raw)
In-Reply-To: <20130207072931.GT22003@b29396-Latitude-E6410>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 2688 bytes --]

Hello.
...
> Thanks for the patch adding non-dt support. :-)
> 
> On Mon, Feb 04, 2013 at 07:00:40PM +0400, Alexander Shiyan wrote:
> > This patch adds support usage platform driver resources, i.e.
> > possibility works without oftree support. Additionally patch
> > removes CONFIG_OF dependency and adds helper for accessing
> > regmap by searching device by its name.
...
> > +static int syscon_match_name(struct device *dev, void *data)
> > +{
> > +	return !strcmp(dev_name(dev), (const char *)data);
> > +}
> > +
> > +struct regmap *syscon_regmap_lookup_by_name(const char *name)
> > +{
> > +	struct syscon *syscon;
> > +	struct device *dev;
> > +
> > +	dev = driver_find_device(&syscon_driver.driver, NULL, (void *)name,
> > +				 syscon_match_name);
> > +	if (!dev)
> > +		return ERR_PTR(-EPROBE_DEFER);
> > +
> > +	syscon = dev_get_drvdata(dev);
> > +
> > +	return syscon->regmap;
> > +}
> > +
> 
> How about syscon_dev_to_regmap(struct device *dev) as the exist dt version
> syscon_node_to_regmap since it's not affected by the name change of devices?

I am not completely understand what you mean. In my version which doing
search regmap by name, we can call this function with desired device name,
then use regmap:
struct regmap *r = syscon_regmap_lookup_by_name("syscon.1");

You suggest use "struct device" as parameter? I do not know what we should
use as parameter to the function in this case, since we can get "struct device"
only when register this device, i.e. in board support code, not from anywhere,
for example from another driver.
Fixme please.

...
> > +	if (IS_ENABLED(CONFIG_OF) && np) {
> > +		syscon->base = of_iomap(np, 0);
> > +		if (!syscon->base)
> > +			return -EADDRNOTAVAIL;
> > +
> > +		res = &res_of;
> > +		ret = of_address_to_resource(np, 0, res);
> > +		if (ret)
> > +			return ret;
> > +	} else {
> > +		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +		if (!res)
> > +			return -ENXIO;
> > +
> > +		if (!request_mem_region(res->start, resource_size(res),
> > +					dev_name(&pdev->dev)))
> > +			return -EBUSY;
> > +
> > +		syscon->base = ioremap(res->start, resource_size(res));
> > +		if (!syscon->base)
> > +			return -EADDRNOTAVAIL;
> 
> devm_request_and_ioremap?

We call of_iomap for DT-version,  for removal procedure - iounmap.
Will iounmap work properly with devm_-version, I'm not sure.
May be better to completely remove ".remove" (and module_exit) feature for driver?
It is loaded at startup always once compiled, and should always be in the system.

Thanks!
---
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2013-02-07  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 15:00 [PATCH] mfd: syscon: Added support for using platform driver resources Alexander Shiyan
2013-02-07  7:29 ` Dong Aisheng
2013-02-07  8:41   ` Alexander Shiyan [this message]
2013-02-07 14:32     ` Re[2]: " Dong Aisheng
2013-02-07 15:52     ` Re[4]: " Alexander Shiyan
2013-02-17  2:40       ` Dong Aisheng
2013-02-18 14:39       ` Re[6]: " Alexander Shiyan

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=1360226494.178606955@f137.mail.ru \
    --to=shc_work@mail.ru \
    --cc=b29396@freescale.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dong.aisheng@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).