Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754857AbbEUCEA (ORCPT ); Wed, 20 May 2015 22:04:00 -0400 Received: from mail-bn1on0131.outbound.protection.outlook.com ([157.56.110.131]:31339 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753452AbbEUCD5 (ORCPT ); Wed, 20 May 2015 22:03:57 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; rowland.harvard.edu; dkim=none (message not signed) header.d=none; Date: Thu, 21 May 2015 10:03:15 +0800 From: Peter Chen To: Rob Herring CC: Greg Kroah-Hartman , Kishon Vijay Abraham I , , , , Arnd Bergmann , Alan Stern Subject: Re: [PATCH v2 5/6] usb: chipidea: allow multiple instances to use default ci_default_pdata Message-ID: <20150521020314.GB26837@shlinux2> References: <1432087805-16671-1-git-send-email-robh@kernel.org> <1432087805-16671-6-git-send-email-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1432087805-16671-6-git-send-email-robh@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11OLC003;1:J0wRUjaz437SktYxkOeRgO85RHN7I+LYs/7MNFUV/g5PW7ZYjY4S7n1RNSVWW+b9t4eeyJfhkgmwGFyaMDqSMl2VbzyZUh6DHtz16FS8b1cN70qBWH/9TW2RudkxhwtfT5fS2RdExaBP2SuUF3bOsUa6bVzVVCMpaoXsoGpjCIUghSEYuraF587bfbjwl+Hn6bHJfNQdVbrhS/99RdedDiyTwe1zt8THesVSyTr771AGsoGvsI6iwhq4UlcDK7uMu1YfNqB4NiMiePGpQHX0St97dFBJS8fEo/S2lFJzzb10cKBQhV9l9tUGXORnQpua X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(189002)(51704005)(24454002)(199003)(76176999)(54356999)(87936001)(33656002)(110136002)(5001960100002)(4001540100001)(5001830100001)(50986999)(86362001)(46102003)(92566002)(46406003)(97756001)(64706001)(4001350100001)(189998001)(97736004)(23726002)(47776003)(5001860100001)(81156007)(83506001)(69596002)(19580405001)(19580395003)(6806004)(50466002)(33716001)(85426001)(2950100001)(62966003)(77156002)(68736005)(77096005)(104016003)(105606002)(106466001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB417;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB417;2:59t3sKA02ShldDEmOSkGCA51RRr8gU0EOy3xaYq3O+ts08+NlcEQq3hNZsFixUJ7;2:sPFvhNJNO+inhohFi5ulph5IosGxWo/z4h2l5redDRYYWZUAe84WPMOB0VaVEuH8vVTgngy9U0BTZcQgOQGJo0AreWakDhHXbD/FoErTOBJr3JsgaUF3QJBTx4FyCU37N9Q9hGR8CRoVyehDkBTlePPCF5th/fI2cGLqwIb8Bywn+vFvavEFXlcj7RW8Cabdi2PMjqUJDlMRWcpAv9U5rXkVHVlrANBkzOVIR0UhT4o=;6:f1Y9oYNaSWdFHgQXlE+PGrQGoTmuKtzYeJZHYgs/N+d+6aKFMUhLiIEObWPZCKR3MR6sjOC+FHeI36B1NCOfBB5q3Szi/nZTTjhjOPONndEs9hTht8v5LZqg4apvfMZAAcncqDJfAGSCE25ZYSh4FjyJmVJMcUBuSMVzy70FjhCOQpgwrGdyE06s1QuiwsOQLfOynEDnal7R1Vuzj6GAqfJ9CHCETTvL5lbVHR9AaW3+ctbk/0zD0LqrhOZUd+DP/mm0Y3dnb74p/VljrAX+kECr1+ufAyWLQraRnFCoyOdPMcU9snQtRU5IWhaWaeYNuGM/L+nvdgKnXR3NLrfHrg==;3:C79UWvvpjIk5w2TAOWNuJuLc7YYNIqajygGNIwoL27QmDgS5feZI4qSCYTv5RiI7YqW/Fvn0W/2RDRnI7KGBKG2y+mnK2ZMRlcoOMnnGIApl7v5lK8h8eLpdxFXah0o5LcyCFDKYU3dHH19FqzQspIxVT/8fw3jjcDDrXpJuXJRlhi5Xvc227YlaCAyIKmkV0JhtLCyJBuPiZ90pPsBkXOWPFRmH1ZhxYgqxwQkjL5QM2PUdAs3prfrkDfqFuqDuPN58OGZNEKsSGbXHHURBorNnlG9g1vCkxQe6oxqHoMA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB417; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BL2PR03MB417;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB417; X-Forefront-PRVS: 0583A86C08 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2PR03MB417;9:yhgFD/XJ4Dwyrfg7cJPito/Ku3UFr02woKiN5hEMDp/?= =?us-ascii?Q?VoxFAeM4chVgD69jl89tSKG4avwE2QBJsia0kPxrMAgl8nwYA2agdfQhjupC?= =?us-ascii?Q?mN/1JRAEJDOaOicnKvGAgBFdDWE9kntzxkZWIgc/ZIdjsEw43FJy89L8SNcY?= =?us-ascii?Q?488QUgXYB1ESToGk9MFDiIwCuQw7aTD3EkBoOwIam1UQ5lgWAKqsAD86X0PI?= =?us-ascii?Q?v7wDM7WUZAcRiw8katSWMwrQFWPdbh1FHmJr/IMWk6Zl1D40hN2tWqJjszSA?= =?us-ascii?Q?aVFpCvuV/UYgCP7lErX6H9479E1eTDy7WYiwN0wH3UsUgQYMEaRfaFa5s64H?= =?us-ascii?Q?EkgqrcpWWbK7dUBpNY+hVZqfAxGL3MxSA4CSUmoaP+LTD7TD1O8FU6nvjl5H?= =?us-ascii?Q?5lDdd6LiFDIMge0wco2Ue7UI2tezd4SIxi0ohstbh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R2Fs6Js6MPg==;10:NRpGXMJgQwm7aQN9KDi7Dwlrh7uM4eHAjfPRE0gWTE9Yjk57Cs8weGqPfagTssrtJp83hLYJujWBGUYXA579w2CW2P3Wp5xRDEcS25ns0XM=;6:suZjN9T0wXNqOwMKShBy2b63xeXEMBXWlzMExQx4USakiXPXqI3Tn94KDqKob7SD X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2015 02:03:54.9652 (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.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB417 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2076 Lines: 64 On Tue, May 19, 2015 at 09:10:04PM -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 | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c > index 45844c9..73d9906 100644 > --- a/drivers/usb/chipidea/ci_hdrc_usb2.c > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c > @@ -25,11 +25,13 @@ 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, > }; > > +static const struct of_device_id ci_hdrc_usb2_of_match[]; > + unrelated change? Others are ok. > static int ci_hdrc_usb2_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -37,8 +39,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 > -- 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/