Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932633AbbFEGeA (ORCPT ); Fri, 5 Jun 2015 02:34:00 -0400 Received: from mail-bn1bon0134.outbound.protection.outlook.com ([157.56.111.134]:60192 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932596AbbFEGd6 (ORCPT ); Fri, 5 Jun 2015 02:33:58 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; arndb.de; dkim=none (message not signed) header.d=none; Date: Fri, 5 Jun 2015 14:32:27 +0800 From: Peter Chen To: Rob Herring CC: Greg Kroah-Hartman , Kishon Vijay Abraham I , , , , Arnd Bergmann Subject: Re: [PATCH v3 5/6] usb: chipidea: allow multiple instances to use default ci_default_pdata Message-ID: <20150605063226.GH15169@shlinux2> References: <1432917526-9688-1-git-send-email-robh@kernel.org> <1432917526-9688-6-git-send-email-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1432917526-9688-6-git-send-email-robh@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD052;1:/fOqw4H315UlmOtLVzxLZYDGiVWVbzqDfaDEIjxP1ZG9EDdtni/NO2xxoI9UhIkVbVjdileVXIzN8nCAIMMtc0YaDh4kK3ZzO850PP+AxYM+9XfcZs13nl8LOaEOl3as6Ubs3vZN+vE+iuIFgGmA9cc28oGVNOTk6UAcRdCeEi5llugEdSWtuNx5a+8Rg88/RwTvAgVNEQ46/mY86sptJaAsuMOnRMLZs49Up+oOk+IXDooEQXqIgap7g2urTCN6N6rC586G7TNum9DTX66zyfhos/d+/i/pcyF01Vt3JXL1fjVQP7Sxmpql3Rqt97y8McVC0ttylSr9D1NuuroXM6gSmo0QTiyolmgllbqwYJ0= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(189002)(199003)(51704005)(24454002)(77156002)(189998001)(54356999)(19580405001)(110136002)(85426001)(62966003)(46102003)(77096005)(76176999)(46406003)(5001960100002)(4001350100001)(105606002)(33716001)(6806004)(87936001)(97756001)(83506001)(5001920100001)(2950100001)(104016003)(50466002)(86362001)(19580395003)(50986999)(33656002)(47776003)(92566002)(106466001)(23726002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB279;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB279;2:zlgz+utY/TM9asixnswUl5dUr0Gv0kqEcGM6ijSsAtdwrMjzf4c+zcc5tYYP3RvG;2:vxIFAjUoQ/vSK6hD/JOqLuuLzdAUrzuCjIBfnx1h3ZriJ0uYKDDgPq0pODjXQwRH3WseOE+CsMLMA289P0WUyj8kzqULl8A/MDdDBl4GydmwR+I63dHowFLoRmgbwHO9usUkPVGz/FBqBRydq9OvV6o+ivQnp7qx3PGsPJshrcy44cmUYxMV45JdipPFeDm1cXKUJsOEtlGaJC9Ogoe9Pi1Yk6Q0tuWg0/9JFcUkTFg=;6:GHL3oQjJcWBvDrIp3jjd5kmK6BP+69OXkXVXlJF0UNeYyzKfkgbg3VXhjDpZPdOOnuIUTgynYHg49rv4UG+s2fm9zSA+3MHU0Hw0IzBcANxpWMAj2POpEPQiheRg6fFCCmpBaQzWfsuYh4RKokHL15ZmYX5mdeABgHXNi9McfldvxZmwZImW8Ogih7hmi7ufq+qNFQijNy7Xqp3wFD4yVUbinI9ZdMnclzxXj/E8ARDQBMJRAHcEzmWjGa5e2LKwmjaMEeIFqmEV2z80rx+TH+zSwLkHLPLvh+Kl7vnxbECgu5OJtwT5F3yLANYq2gEXbRJILo33Fd6H6qYoQZesAw==;3:pqW3HGIKcOUvyMqrfXw9n+nsahiFvyy7ROjNmVCxxhYUdVXwlKk4tPwCxVWml8aFuPd93FiSgR/yhRunZS4S3CReUR2Dfs4YbdVe1Hy/b/2DE5WZ7L2QHcubg84j9VXnaNqSHOZktvRvn2TEAh4vXvlATuQWH1Pb8vJbDBup7xl+H+vbV88yfhM87HV908XHnmZ6P7bSS4QEkWJ8w+EgQzeiVymQzkbjreqxe3n5cyuCeg0YstCfke+hTkPiEnbQ42NTWSBPbniUnW7IV7pHMcjFaVBDwetaAdMkwTtLbv7n8VK9kUJNWQK9huSM8ppi X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB279; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:BLUPR03MB279;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB279; X-Forefront-PRVS: 05986C03E0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR03MB279;9:J0bRjyUspi74TsWZzOqOtJVJT6FxMi7vzetw4mF8Cq2?= =?us-ascii?Q?xzndKAKZruTQAV7RYQ+AsWYNRM7w1q1ndy6qDvVNaTBmOVAijp0iStJG3MS2?= =?us-ascii?Q?q+8tlce5O9ux3XHRDt29c4bY3/SeWDAueM9cHulC0x063UNsCRLuxAUovLG+?= =?us-ascii?Q?0V0vENsph6Sk+fEDTXWCo2jz7/6CoDpGDBTgDH0Hdiiy/GvlnytPp5euHHiu?= =?us-ascii?Q?e9z7bEz2v1jSMNJTVh8CIAqmcTPfQCINnQPgZvwlKUpO16M0X8kBeM4+Yxro?= =?us-ascii?Q?t3bYQT8QQ+DExqJYG0Ox+XqTfZBKYzNGTRM4/Zr519zuGLg0yZZhGs6SMysF?= =?us-ascii?Q?vtyaw/4vuzRNbsWj7YtVz2ljJcjiOJ94BASJ96urRk3qP0oDHUh/WhZ16NBF?= =?us-ascii?Q?XIFMH02WMsg+lAMifu5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N55NwYzFO+xZJea9MC3 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2015 06:33:56.8562 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB279 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1910 Lines: 55 On Fri, May 29, 2015 at 11:38:45AM -0500, Rob Herring wrote: > Currently, ci_default_pdata is common to all instances of the driver and > gets modified by the core driver code. This is bad if there are multiple > instances of the device with different settings such as the phy type. Fix > this by making a copy of the default platform_data. > > Signed-off-by: Rob Herring > Cc: Peter Chen > Cc: Greg Kroah-Hartman > Cc: linux-usb@vger.kernel.org > --- > drivers/usb/chipidea/ci_hdrc_usb2.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c > index 45844c9..9eae1a1 100644 > --- a/drivers/usb/chipidea/ci_hdrc_usb2.c > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c > @@ -25,7 +25,7 @@ struct ci_hdrc_usb2_priv { > struct clk *clk; > }; > > -static struct ci_hdrc_platform_data ci_default_pdata = { > +static const struct ci_hdrc_platform_data ci_default_pdata = { > .capoffset = DEF_CAPOFFSET, > .flags = CI_HDRC_DISABLE_STREAMING, > }; > @@ -37,8 +37,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) > struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); > int ret; > > - if (!ci_pdata) > - ci_pdata = &ci_default_pdata; > + if (!ci_pdata) { > + ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); > + *ci_pdata = ci_default_pdata; /* struct copy */ > + } > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > -- > 2.1.0 > Acked-by: Peter Chen -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/