From patchwork Fri Dec 2 16:58:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 5434 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A027A23E04 for ; Fri, 2 Dec 2011 16:58:30 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 754EFA1868E for ; Fri, 2 Dec 2011 16:58:30 +0000 (UTC) Received: by laah2 with SMTP id h2so1853938laa.11 for ; Fri, 02 Dec 2011 08:58:30 -0800 (PST) Received: by 10.152.104.1 with SMTP id ga1mr8454475lab.40.1322845110103; Fri, 02 Dec 2011 08:58:30 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs121944lal; Fri, 2 Dec 2011 08:58:29 -0800 (PST) Received: by 10.180.90.195 with SMTP id by3mr10877251wib.30.1322845106818; Fri, 02 Dec 2011 08:58:26 -0800 (PST) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id ez9si4605557wbb.69.2011.12.02.08.58.26 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Dec 2011 08:58:26 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) smtp.mail=dave.martin@linaro.org Received: by mail-ww0-f50.google.com with SMTP id dr11so1510565wgb.31 for ; Fri, 02 Dec 2011 08:58:26 -0800 (PST) Received: by 10.227.207.10 with SMTP id fw10mr6814287wbb.2.1322845106112; Fri, 02 Dec 2011 08:58:26 -0800 (PST) Received: from e103592.peterhouse.linaro.org (fw-lnat.cambridge.arm.com. [217.140.96.63]) by mx.google.com with ESMTPS id gg1sm11009102wbb.17.2011.12.02.08.58.24 (version=SSLv3 cipher=OTHER); Fri, 02 Dec 2011 08:58:25 -0800 (PST) From: Dave Martin To: linux-usb@vger.kernel.org Cc: patches@linaro.org, Grant Likely , Arvid Brodin , devicetree-discuss@lists.ozlabs.org, Dave Martin Subject: [PATCH v2] isp1760: Fix endianness-sensitivity in of_isp1760_probe() Date: Fri, 2 Dec 2011 16:58:18 +0000 Message-Id: <1322845098-19516-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 Data read direct from device tree properties will be in the device tree's native endianness (i.e., big-endian). This patch uses of_property_read_u32() to read the bus-width property in host byte order instead. Signed-off-by: Dave Martin Acked-by: Pawel Moll --- Changes since v1: v2: Rebased against v3.2-rc3 Fix typo'd call to of_property_read_u32() Tested on Versatile Express with Pawel Moll's DT support series: http://lists.infradead.org/pipermail/linux-arm-kernel/2011-November/074440.html drivers/usb/host/isp1760-if.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index a7dc1e1..b605224 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c @@ -47,9 +47,9 @@ static int of_isp1760_probe(struct platform_device *dev) int virq; resource_size_t res_len; int ret; - const unsigned int *prop; unsigned int devflags = 0; enum of_gpio_flags gpio_flags; + u32 bus_width = 0; drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); if (!drvdata) @@ -77,8 +77,8 @@ static int of_isp1760_probe(struct platform_device *dev) devflags |= ISP1760_FLAG_ISP1761; /* Some systems wire up only 16 of the 32 data lines */ - prop = of_get_property(dp, "bus-width", NULL); - if (prop && *prop == 16) + of_property_read_u32(dp, "bus-width", &bus_width); + if (bus_width == 16) devflags |= ISP1760_FLAG_BUS_WIDTH_16; if (of_get_property(dp, "port1-otg", NULL) != NULL)