Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t

2013-06-02 Thread Emil Goode
Maybe wait and see if %pa gets more usage and if the discussion comes up again.

Best regards,

Emil

On Sat, Jun 01, 2013 at 04:22:18PM -0700, Joe Perches wrote:
 On Sun, 2013-06-02 at 01:06 +0200, Emil Goode wrote:
  Maybe there should be another format specifier %da and Randy's
  clarifying comment
 
 maybe %pad but I think the whole thing isn't much necessary.
 It seems there are a grand total of 3 uses of %pa today.
 
 Maybe:
 ---
  Documentation/printk-formats.txt |  7 +++
  lib/vsprintf.c   | 19 +++
  2 files changed, 22 insertions(+), 4 deletions(-)
 
 diff --git a/Documentation/printk-formats.txt 
 b/Documentation/printk-formats.txt
 index 3af5ae6..fa48403 100644
 --- a/Documentation/printk-formats.txt
 +++ b/Documentation/printk-formats.txt
 @@ -63,6 +63,13 @@ Physical addresses:
   resource_size_t) which can vary based on build options, regardless of
   the width of the CPU data path. Passed by reference.
  
 +dma_addr_t addresses:
 +
 + %pad0x01234567 or 0x0123456789abcdef
 +
 + For printing a dma_addr_t type which can vary based on build options,
 + regardless of the width of the CPU data path. Passed by reference.
 +
  Raw buffer as a hex string:
   %*ph00 01 02  ...  3f
   %*phC   00:01:02: ... :3f
 diff --git a/lib/vsprintf.c b/lib/vsprintf.c
 index 7d84676..b6b8390 100644
 --- a/lib/vsprintf.c
 +++ b/lib/vsprintf.c
 @@ -1039,6 +1039,7 @@ int kptr_restrict __read_mostly;
   *The maximum supported length is 64 bytes of the input. Consider
   *to use print_hex_dump() for the larger input.
   * - 'a' For a phys_addr_t type and its derivative types (passed by 
 reference)
 + * - 'ad' For a dma_addr_t type
   *
   * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
   * function pointers are really function descriptors, which contain a
 @@ -1129,12 +1130,22 @@ char *pointer(const char *fmt, char *buf, char *end, 
 void *ptr,
   return netdev_feature_string(buf, end, ptr, spec);
   }
   break;
 - case 'a':
 + case 'a': {
 + unsigned long long val;
   spec.flags |= SPECIAL | SMALL | ZEROPAD;
 - spec.field_width = sizeof(phys_addr_t) * 2 + 2;
   spec.base = 16;
 - return number(buf, end,
 -   (unsigned long long) *((phys_addr_t *)ptr), spec);
 + switch (fmt[1]) {
 + case 'd':
 + spec.field_width = sizeof(dma_addr_t) * 2 + 2;
 + val = (unsigned long long)*((dma_addr_t *)ptr);
 + break;
 + default:
 + spec.field_width = sizeof(phys_addr_t) * 2 + 2;
 + val = (unsigned long long)*((phys_addr_t *)ptr);
 + break;
 + }
 + return number(buf, end, val, spec);
 + }
   }
   spec.flags |= SMALL;
   if (spec.field_width == -1) {
 
 
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC Patch] USB: Add check for portnum in the usb_acpi_find_device()

2013-06-02 Thread Lan Tianyu

On 2013/5/31 19:18 Greg KH wrote the following:

On Fri, May 31, 2013 at 02:18:06PM +0800, Lan Tianyu wrote:

This patch is to add a check of portnum which from the usb
port dev's name.


Why do we need this now?


The portnum will be used as array index
for struct usb_hub-ports in the usb_set_hub_port_connect_type().


Is something failing today without this check?  We don't add code to the
kernel until we need it...

No, actually current code will not fail. The patch is the result of
analysis tools Klockwork which is pushed by some QAs. I just notice 
you have said to be over-eager in checking parameters that we have full 
control of is not needed at all. So please ignore this. Sorry for noise.


http://marc.info/?l=linux-usbm=136984950910015w=2


thanks,

greg k-h



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2 1/2] USB: OHCI: make ohci-platform a separate driver

2013-06-02 Thread Alan Stern
On Sun, 2 Jun 2013, Manjunath Goudar wrote:

 On 31 May 2013 19:37, Alan Stern st...@rowland.harvard.edu wrote:
 

   + return ohci_setup(ohci_to_hcd(ohci));
 
  You don't need to use ohci_to_hcd(), because the hcd value is already a
  parameter in this function.
 
 
 After setting ohci's flag and  num_ports,we need to convert ohci to hcd
 that is what called ohci_to_hcd() function.

No, you don't need to convert it.  Just do:

return ohci_setup(hcd);

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 2/3] ARM: shmobile: r8a7778: add USB support

2013-06-02 Thread Kuninori Morimoto

Hi


 Add USB clock and EHCI, OHCI, and USB PHY platform devices for R8A7778 SoC;  
 add
 a function to register PHY device with board-specific platform data and 
 register
 EHCI and OHCI platfrom devices from the init_late() board method.
 
 Also,  don't forget to enable CONFIG_ARCH_HAS_[EO]HCI options for R8A7778 SoC 
 in
 Kconfig...
 
 The patch has been tested on the BOCK-W board.
 
 Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com
 ---
(snip)
 +void __init r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
 +{
 + platform_device_register_resndata(platform_bus, rcar_usb_phy, -1,
 +   usb_phy_resources,
 +   ARRAY_SIZE(usb_phy_resources),
 +   pdata, sizeof(*pdata));
 +}
(snip)
 +void __init r8a7778_init_late(void)
 +{
 + phy = usb_get_phy(USB_PHY_TYPE_USB2);
 +
 + platform_device_register_full(ehci_info);
 + platform_device_register_full(ohci_info);
 +}

This means ehci/ohci device registration happened compulsorily if Soc/platform 
calls r8a7778_init_late().
but, usb phy isn't registered without r8a7778_add_usb_phy_device().

The ohci/ehci resource will be  used vainly if platform doesn't have USB

ohci/ehci and phy should be registered in same time/function.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] dwc2: remove redundant D0 power state set

2013-06-02 Thread Yijing Wang
Pci_enable_device() will set device power state to D0,
so it's no need to do it again in dwc2_driver_probe().

Acked-by: Paul Zimmerman pa...@synopsys.com
Signed-off-by: Yijing Wang wangyij...@huawei.com
Cc: Paul Zimmerman pa...@synopsys.com
Cc: linux-usb@vger.kernel.org
Cc: de...@driverdev.osuosl.org
---
 drivers/staging/dwc2/pci.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dwc2/pci.c b/drivers/staging/dwc2/pci.c
index 69c65eb..6a196c2 100644
--- a/drivers/staging/dwc2/pci.c
+++ b/drivers/staging/dwc2/pci.c
@@ -131,8 +131,6 @@ static int dwc2_driver_probe(struct pci_dev *dev,
if (!hsotg)
return -ENOMEM;
 
-   pci_set_power_state(dev, PCI_D0);
-
hsotg-dev = dev-dev;
hsotg-regs = devm_request_and_ioremap(dev-dev, dev-resource[0]);
if (!hsotg-regs)
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] usb, dwc3: remove redundant D0 power state set

2013-06-02 Thread Yijing Wang
Pci_enable_device() will set device power state to D0,
so it's no need to do it again in dwc3_pci_probe().

Signed-off-by: Yijing Wang wangyij...@huawei.com
Cc: Felipe Balbi ba...@ti.com
Cc: linux-o...@vger.kernel.org
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/dwc3/dwc3-pci.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 227d4a7..c068608 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -133,7 +133,6 @@ static int dwc3_pci_probe(struct pci_dev *pci,
return -ENODEV;
}
 
-   pci_set_power_state(pci, PCI_D0);
pci_set_master(pci);
 
ret = dwc3_pci_register_phys(glue);
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] usb, chipidea: remove redundant D0 power state set

2013-06-02 Thread Yijing Wang
Pci_enable_device() will set device power state to D0,
so it's no need to do it again in ci13xxx_pci_probe().

Signed-off-by: Yijing Wang wangyij...@huawei.com
Cc: Alexander Shishkin alexander.shish...@linux.intel.com
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/chipidea/ci13xxx_pci.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_pci.c 
b/drivers/usb/chipidea/ci13xxx_pci.c
index 4e1fc61..a2a6ac8 100644
--- a/drivers/usb/chipidea/ci13xxx_pci.c
+++ b/drivers/usb/chipidea/ci13xxx_pci.c
@@ -71,7 +71,6 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
goto disable_device;
}
 
-   pci_set_power_state(pdev, PCI_D0);
pci_set_master(pdev);
pci_try_set_mwi(pdev);
 
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html