All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
To: balbi-l0cyMroinI0@public.gmane.org
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Subbaraya Sundeep Bhatta
	<subbaraya.sundeep.bhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Subbaraya Sundeep Bhatta
	<sbhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support
Date: Fri, 21 Feb 2014 16:51:07 +0100	[thread overview]
Message-ID: <530775EB.6030004@monstr.eu> (raw)
In-Reply-To: <20140221154244.GG31902-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

On 02/21/2014 04:42 PM, Felipe Balbi wrote:
> Hi,
> 
> On Fri, Feb 21, 2014 at 02:41:03PM +0100, Michal Simek wrote:
>>>>> +	/* Map the registers */
>>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>> +	udc->base_address = devm_ioremap_nocache(&pdev->dev, res->start,
>>>>> +						 resource_size(res));
>>>>
>>>> use devm_ioremap_resource() instead.
>>>
>>> Also, res might be NULL. You should check that before dereferencing it.
>>
>> yes it is necessary for both cases with devm_ioremap_nocache
>> or with devm_ioremap_resource.
> 
> read the source Luke:
> 
> | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
> | {
> | 	resource_size_t size;
> | 	const char *name;
> | 	void __iomem *dest_ptr;
> | 
> | 	BUG_ON(!dev);
> | 
> | 	if (!res || resource_type(res) != IORESOURCE_MEM) {
>             ^^^^
> 	    already done for you
> 
> | 		dev_err(dev, "invalid resource\n");
> | 		return ERR_PTR(-EINVAL);
> | 	}
> | 
> | 	size = resource_size(res);
> | 	name = res->name ?: dev_name(dev);
> | 
> | 	if (!devm_request_mem_region(dev, res->start, size, name)) {
> | 		dev_err(dev, "can't request region for resource %pR\n", res);
> | 		return ERR_PTR(-EBUSY);
> | 	}
> | 
> | 	if (res->flags & IORESOURCE_CACHEABLE)
> | 		dest_ptr = devm_ioremap(dev, res->start, size);
> | 	else
> | 		dest_ptr = devm_ioremap_nocache(dev, res->start, size);

I have read it just not sure if IORESOURCE_CACHEABLE is setup by default
or not.
If yes, then you have to setup res->flags in your driver and have to
check it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <monstr@monstr.eu>
To: balbi@ti.com
Cc: Mark Rutland <mark.rutland@arm.com>,
	Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support
Date: Fri, 21 Feb 2014 16:51:07 +0100	[thread overview]
Message-ID: <530775EB.6030004@monstr.eu> (raw)
In-Reply-To: <20140221154244.GG31902@saruman.home>

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

On 02/21/2014 04:42 PM, Felipe Balbi wrote:
> Hi,
> 
> On Fri, Feb 21, 2014 at 02:41:03PM +0100, Michal Simek wrote:
>>>>> +	/* Map the registers */
>>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>> +	udc->base_address = devm_ioremap_nocache(&pdev->dev, res->start,
>>>>> +						 resource_size(res));
>>>>
>>>> use devm_ioremap_resource() instead.
>>>
>>> Also, res might be NULL. You should check that before dereferencing it.
>>
>> yes it is necessary for both cases with devm_ioremap_nocache
>> or with devm_ioremap_resource.
> 
> read the source Luke:
> 
> | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
> | {
> | 	resource_size_t size;
> | 	const char *name;
> | 	void __iomem *dest_ptr;
> | 
> | 	BUG_ON(!dev);
> | 
> | 	if (!res || resource_type(res) != IORESOURCE_MEM) {
>             ^^^^
> 	    already done for you
> 
> | 		dev_err(dev, "invalid resource\n");
> | 		return ERR_PTR(-EINVAL);
> | 	}
> | 
> | 	size = resource_size(res);
> | 	name = res->name ?: dev_name(dev);
> | 
> | 	if (!devm_request_mem_region(dev, res->start, size, name)) {
> | 		dev_err(dev, "can't request region for resource %pR\n", res);
> | 		return ERR_PTR(-EBUSY);
> | 	}
> | 
> | 	if (res->flags & IORESOURCE_CACHEABLE)
> | 		dest_ptr = devm_ioremap(dev, res->start, size);
> | 	else
> | 		dest_ptr = devm_ioremap_nocache(dev, res->start, size);

I have read it just not sure if IORESOURCE_CACHEABLE is setup by default
or not.
If yes, then you have to setup res->flags in your driver and have to
check it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  parent reply	other threads:[~2014-02-21 15:51 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19  9:40 [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support Subbaraya Sundeep Bhatta
     [not found] ` <774153d4-d33f-4bb4-813b-582762bc3af9-8XeO8fnFoNFnw48GICbVzrjjLBE8jN/0@public.gmane.org>
2014-02-20 18:23   ` Felipe Balbi
2014-02-20 18:23     ` Felipe Balbi
2014-02-21 11:27     ` Subbaraya Sundeep Bhatta
2014-02-21 15:39       ` Felipe Balbi
     [not found]         ` <20140221153905.GE31902-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-03-10 13:36           ` sundeep subbaraya
2014-03-10 13:36             ` sundeep subbaraya
2014-03-10 18:44             ` Felipe Balbi
2014-03-10 18:44               ` Felipe Balbi
2014-02-21 12:04     ` Mark Rutland
2014-02-21 13:41       ` Michal Simek
2014-02-21 13:57         ` Mark Rutland
2014-02-21 14:06           ` Michal Simek
2014-02-21 15:42         ` Felipe Balbi
     [not found]           ` <20140221154244.GG31902-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-02-21 15:51             ` Michal Simek [this message]
2014-02-21 15:51               ` Michal Simek
2014-02-21 16:00               ` Felipe Balbi
2014-02-21 16:00                 ` Felipe Balbi
     [not found]               ` <530775EB.6030004-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-21 16:15                 ` Arnd Bergmann
2014-02-21 16:15                   ` Arnd Bergmann
     [not found]       ` <20140221120454.GD8783-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-21 15:41         ` Felipe Balbi
2014-02-21 15:41           ` Felipe Balbi
2014-02-21 16:13           ` Mark Rutland
     [not found]     ` <20140220182257.GF23217-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-02-21  6:38       ` Michal Simek
2014-02-21  6:38         ` Michal Simek
2014-02-21 16:04         ` Greg Kroah-Hartman
     [not found]           ` <20140221160442.GA17506-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-02-21 16:04             ` Michal Simek
2014-02-21 16:04               ` Michal Simek
     [not found]               ` <5307790A.4050806-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-21 16:12                 ` SPDX-License-Identifier (was: Re: [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support) Felipe Balbi
2014-02-21 16:12                   ` Felipe Balbi
     [not found]                   ` <20140221161246.GM31902-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-02-21 16:18                     ` SPDX-License-Identifier Michal Simek
2014-02-21 16:18                       ` SPDX-License-Identifier Michal Simek
     [not found]                       ` <53077C5F.9000407-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-21 16:20                         ` SPDX-License-Identifier Felipe Balbi
2014-02-21 16:20                           ` SPDX-License-Identifier Felipe Balbi
2014-02-21 16:56                           ` SPDX-License-Identifier Greg Kroah-Hartman
2014-02-21 17:26                             ` SPDX-License-Identifier Michal Simek
     [not found]                               ` <53078C30.7060703-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-21 17:57                                 ` SPDX-License-Identifier Greg Kroah-Hartman
2014-02-21 17:57                                   ` SPDX-License-Identifier Greg Kroah-Hartman
2014-02-21 19:01                                   ` SPDX-License-Identifier Theodore Ts'o
2014-02-24 10:12                                     ` SPDX-License-Identifier Michal Simek
     [not found]                                       ` <530B1B25.5090601-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-24 13:41                                         ` SPDX-License-Identifier Theodore Ts'o
2014-02-24 13:41                                           ` SPDX-License-Identifier Theodore Ts'o
2014-02-24 14:03                                           ` SPDX-License-Identifier Michal Simek
     [not found]                                             ` <530B512D.8090308-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-02-24 14:26                                               ` SPDX-License-Identifier Greg Kroah-Hartman
2014-02-24 14:26                                                 ` SPDX-License-Identifier Greg Kroah-Hartman
2014-02-25 12:10                                                 ` SPDX-License-Identifier One Thousand Gnomes
2014-02-25 12:25                                                   ` SPDX-License-Identifier Geert Uytterhoeven
2015-02-02 15:43                         ` SPDX-License-Identifier Stefan Roese
2015-02-02 15:43                           ` SPDX-License-Identifier Stefan Roese
     [not found]                           ` <54CF9B12.2070807-ynQEQJNshbs@public.gmane.org>
2015-02-02 16:06                             ` SPDX-License-Identifier Greg Kroah-Hartman
2015-02-02 16:06                               ` SPDX-License-Identifier Greg Kroah-Hartman
     [not found]                               ` <20150202160622.GA9852-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-02-04 16:41                                 ` SPDX-License-Identifier Stefan Roese
2015-02-04 16:41                                   ` SPDX-License-Identifier Stefan Roese
     [not found]                                   ` <54D24BA4.3070509-ynQEQJNshbs@public.gmane.org>
2015-02-05  4:21                                     ` SPDX-License-Identifier Theodore Ts'o
2015-02-05  4:21                                       ` SPDX-License-Identifier Theodore Ts'o
2015-02-05  6:41                                     ` SPDX-License-Identifier Greg Kroah-Hartman
2015-02-05  6:41                                       ` SPDX-License-Identifier Greg Kroah-Hartman
2015-02-25 21:49                                       ` SPDX-License-Identifier Pavel Machek
2015-02-25 22:00                                         ` SPDX-License-Identifier Felipe Balbi
2015-02-25 22:00                                           ` SPDX-License-Identifier Felipe Balbi
2015-02-26 21:49                                           ` SPDX-License-Identifier Pavel Machek
2015-02-26 10:26                                         ` SPDX-License-Identifier One Thousand Gnomes
2015-02-26 10:26                                           ` SPDX-License-Identifier One Thousand Gnomes
2015-02-26 13:39                                           ` SPDX-License-Identifier Theodore Ts'o
2015-02-26 21:53                                           ` SPDX-License-Identifier Pavel Machek
2015-02-05 11:49                                     ` SPDX-License-Identifier One Thousand Gnomes
2015-02-05 11:49                                       ` SPDX-License-Identifier One Thousand Gnomes
2014-02-21 16:23               ` [PATCH RFC] usb: gadget: Add xilinx axi usb2 device support Greg Kroah-Hartman
2014-03-26 10:07       ` sundeep subbaraya
2014-03-26 10:07         ` sundeep subbaraya
2014-04-15 17:18         ` Felipe Balbi
2014-04-15 17:18           ` Felipe Balbi
2014-04-15 17:55           ` Alan Stern
     [not found]             ` <Pine.LNX.4.44L0.1404151345580.1310-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-04-16  4:39               ` Felipe Balbi
2014-04-16  4:39                 ` Felipe Balbi

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=530775EB.6030004@monstr.eu \
    --to=monstr-psz03upnqpehxe+lvdladg@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=sbhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    --cc=subbaraya.sundeep.bhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.