Skip to content

Commit

Permalink
USB: host: use dev_get_platdata()
Browse files Browse the repository at this point in the history
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jingoo Han authored and Greg Kroah-Hartman committed Aug 1, 2013
1 parent 4fae6f0 commit d4f09e2
Show file tree
Hide file tree
Showing 26 changed files with 65 additions and 64 deletions.
14 changes: 7 additions & 7 deletions drivers/usb/host/ehci-fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
pr_debug("initializing FSL-SOC USB Controller\n");

/* Need platform data for setup */
pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data;
pdata = (struct fsl_usb2_platform_data *)dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev,
"No platform data for %s.\n", dev_name(&pdev->dev));
Expand Down Expand Up @@ -190,7 +190,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);

if (!IS_ERR_OR_NULL(hcd->phy)) {
otg_set_host(hcd->phy->otg, NULL);
Expand Down Expand Up @@ -218,7 +218,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
void __iomem *non_ehci = hcd->regs;
struct device *dev = hcd->self.controller;
struct fsl_usb2_platform_data *pdata = dev->platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);

if (pdata->controller_ver < 0) {
dev_warn(hcd->self.controller, "Could not get controller version\n");
Expand Down Expand Up @@ -291,7 +291,7 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
struct fsl_usb2_platform_data *pdata;
void __iomem *non_ehci = hcd->regs;

pdata = hcd->self.controller->platform_data;
pdata = dev_get_platdata(hcd->self.controller);

if (pdata->have_sysif_regs) {
/*
Expand Down Expand Up @@ -363,7 +363,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
struct device *dev;

dev = hcd->self.controller;
pdata = hcd->self.controller->platform_data;
pdata = dev_get_platdata(hcd->self.controller);
ehci->big_endian_desc = pdata->big_endian_desc;
ehci->big_endian_mmio = pdata->big_endian_mmio;

Expand Down Expand Up @@ -415,7 +415,7 @@ static int ehci_fsl_mpc512x_drv_suspend(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct fsl_usb2_platform_data *pdata = dev->platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);
u32 tmp;

#ifdef DEBUG
Expand Down Expand Up @@ -484,7 +484,7 @@ static int ehci_fsl_mpc512x_drv_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct fsl_usb2_platform_data *pdata = dev->platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(dev);
u32 tmp;

dev_dbg(dev, "suspend=%d already_suspended=%d\n",
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static const struct hc_driver mv_ehci_hc_driver = {

static int mv_ehci_probe(struct platform_device *pdev)
{
struct mv_usb_platform_data *pdata = pdev->dev.platform_data;
struct mv_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct ehci_hcd_mv *ehci_mv;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/host/ehci-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static const struct ehci_driver_overrides ehci_mxc_overrides __initconst = {

static int ehci_mxc_drv_probe(struct platform_device *pdev)
{
struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
struct mxc_usbh_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct usb_hcd *hcd;
struct resource *res;
int irq, ret;
Expand Down Expand Up @@ -174,7 +174,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)

static int ehci_mxc_drv_remove(struct platform_device *pdev)
{
struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
struct mxc_usbh_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct ehci_mxc_priv *priv = (struct ehci_mxc_priv *) ehci->priv;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/host/ehci-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
static int ehci_hcd_omap_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct usbhs_omap_platform_data *pdata = dev->platform_data;
struct usbhs_omap_platform_data *pdata = dev_get_platdata(dev);
struct resource *res;
struct usb_hcd *hcd;
void __iomem *regs;
Expand All @@ -119,7 +119,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)

/* For DT boot, get platform data from parent. i.e. usbhshost */
if (dev->of_node) {
pdata = dev->parent->platform_data;
pdata = dev_get_platdata(dev->parent);
dev->platform_data = pdata;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,

static int ehci_orion_drv_probe(struct platform_device *pdev)
{
struct orion_ehci_data *pd = pdev->dev.platform_data;
struct orion_ehci_data *pd = dev_get_platdata(&pdev->dev);
const struct mbus_dram_target_info *dram;
struct resource *res;
struct usb_hcd *hcd;
Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/host/ehci-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static const char hcd_name[] = "ehci-platform";
static int ehci_platform_reset(struct usb_hcd *hcd)
{
struct platform_device *pdev = to_platform_device(hcd->self.controller);
struct usb_ehci_pdata *pdata = pdev->dev.platform_data;
struct usb_ehci_pdata *pdata = dev_get_platdata(&pdev->dev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
int retval;

Expand Down Expand Up @@ -87,14 +87,14 @@ static int ehci_platform_probe(struct platform_device *dev)
* use reasonable defaults so platforms don't have to provide these.
* with DT probing on ARM, none of these are set.
*/
if (!dev->dev.platform_data)
if (!dev_get_platdata(&dev->dev))
dev->dev.platform_data = &ehci_platform_defaults;
if (!dev->dev.dma_mask)
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
if (!dev->dev.coherent_dma_mask)
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);

pdata = dev->dev.platform_data;
pdata = dev_get_platdata(&dev->dev);

irq = platform_get_irq(dev, 0);
if (irq < 0) {
Expand Down Expand Up @@ -148,7 +148,7 @@ static int ehci_platform_probe(struct platform_device *dev)
static int ehci_platform_remove(struct platform_device *dev)
{
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_ehci_pdata *pdata = dev->dev.platform_data;
struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);

usb_remove_hcd(hcd);
usb_put_hcd(hcd);
Expand All @@ -167,7 +167,7 @@ static int ehci_platform_remove(struct platform_device *dev)
static int ehci_platform_suspend(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct usb_ehci_pdata *pdata = dev->platform_data;
struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
struct platform_device *pdev =
container_of(dev, struct platform_device, dev);
bool do_wakeup = device_may_wakeup(dev);
Expand All @@ -184,7 +184,7 @@ static int ehci_platform_suspend(struct device *dev)
static int ehci_platform_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct usb_ehci_pdata *pdata = dev->platform_data;
struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
struct platform_device *pdev =
container_of(dev, struct platform_device, dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-s5p.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev)

static int s5p_ehci_probe(struct platform_device *pdev)
{
struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
struct s5p_ehci_platdata *pdata = dev_get_platdata(&pdev->dev);
struct s5p_ehci_hcd *s5p_ehci;
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
goto fail_create_hcd;
}

pdata = pdev->dev.platform_data;
pdata = dev_get_platdata(&pdev->dev);

/* initialize hcd */
hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
struct device_node *np_phy;
struct usb_phy *u_phy;

pdata = pdev->dev.platform_data;
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "Platform data missing\n");
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/host/ehci-tilegx.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev)
{
struct usb_hcd *hcd;
struct ehci_hcd *ehci;
struct tilegx_usb_platform_data *pdata = pdev->dev.platform_data;
struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
pte_t pte = { 0 };
int my_cpu = smp_processor_id();
int ret;
Expand Down Expand Up @@ -186,7 +186,7 @@ static int ehci_hcd_tilegx_drv_probe(struct platform_device *pdev)
static int ehci_hcd_tilegx_drv_remove(struct platform_device *pdev)
{
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct tilegx_usb_platform_data *pdata = pdev->dev.platform_data;
struct tilegx_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);

usb_remove_hcd(hcd);
usb_put_hcd(hcd);
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/host/fsl-mph-dr-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static int fsl_usb2_mph_dr_of_remove(struct platform_device *ofdev)

int fsl_usb2_mpc5121_init(struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct clk *clk;
char clk_name[10];
int base, clk_num;
Expand Down Expand Up @@ -298,7 +298,7 @@ int fsl_usb2_mpc5121_init(struct platform_device *pdev)

static void fsl_usb2_mpc5121_exit(struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);

pdata->regs = NULL;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/imx21-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ static int imx21_probe(struct platform_device *pdev)
imx21 = hcd_to_imx21(hcd);
imx21->hcd = hcd;
imx21->dev = &pdev->dev;
imx21->pdata = pdev->dev.platform_data;
imx21->pdata = dev_get_platdata(&pdev->dev);
if (!imx21->pdata)
imx21->pdata = &default_pdata;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/isp116x-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ static int isp116x_probe(struct platform_device *pdev)
isp116x->addr_reg = addr_reg;
spin_lock_init(&isp116x->lock);
INIT_LIST_HEAD(&isp116x->async);
isp116x->board = pdev->dev.platform_data;
isp116x->board = dev_get_platdata(&pdev->dev);

if (!isp116x->board) {
ERR("Platform data structure not initialized\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/isp1362-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2725,7 +2725,7 @@ static int isp1362_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&isp1362_hcd->periodic);
INIT_LIST_HEAD(&isp1362_hcd->isoc);
INIT_LIST_HEAD(&isp1362_hcd->remove_list);
isp1362_hcd->board = pdev->dev.platform_data;
isp1362_hcd->board = dev_get_platdata(&pdev->dev);
#if USE_PLATFORM_DELAY
if (!isp1362_hcd->board->delay) {
dev_err(hcd->self.controller, "No platform delay function given\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/isp1760-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static int isp1760_plat_probe(struct platform_device *pdev)
struct resource *mem_res;
struct resource *irq_res;
resource_size_t mem_size;
struct isp1760_platform_data *priv = pdev->dev.platform_data;
struct isp1760_platform_data *priv = dev_get_platdata(&pdev->dev);
unsigned int devflags = 0;
unsigned long irqflags = IRQF_SHARED;

Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/host/ohci-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
static int
ohci_at91_reset (struct usb_hcd *hcd)
{
struct at91_usbh_data *board = hcd->self.controller->platform_data;
struct at91_usbh_data *board = dev_get_platdata(hcd->self.controller);
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
int ret;

Expand Down Expand Up @@ -280,7 +280,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
*/
static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
{
struct at91_usbh_data *pdata = hcd->self.controller->platform_data;
struct at91_usbh_data *pdata = dev_get_platdata(hcd->self.controller);
int length = ohci_hub_status_data(hcd, buf);
int port;

Expand All @@ -301,7 +301,7 @@ static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
u16 wIndex, char *buf, u16 wLength)
{
struct at91_usbh_data *pdata = hcd->self.controller->platform_data;
struct at91_usbh_data *pdata = dev_get_platdata(hcd->self.controller);
struct usb_hub_descriptor *desc;
int ret = -EINVAL;
u32 *data = (u32 *)buf;
Expand Down Expand Up @@ -461,7 +461,7 @@ static const struct hc_driver ohci_at91_hc_driver = {
static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
{
struct platform_device *pdev = data;
struct at91_usbh_data *pdata = pdev->dev.platform_data;
struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
int val, gpio, port;

/* From the GPIO notifying the over-current situation, find
Expand Down Expand Up @@ -567,7 +567,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
if (ret)
return ret;

pdata = pdev->dev.platform_data;
pdata = dev_get_platdata(&pdev->dev);

if (pdata) {
at91_for_each_port(i) {
Expand Down Expand Up @@ -643,7 +643,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)

static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
{
struct at91_usbh_data *pdata = pdev->dev.platform_data;
struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
int i;

if (pdata) {
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/host/ohci-da8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static void ohci_da8xx_ocic_handler(struct da8xx_ohci_root_hub *hub,
static int ohci_da8xx_init(struct usb_hcd *hcd)
{
struct device *dev = hcd->self.controller;
struct da8xx_ohci_root_hub *hub = dev->platform_data;
struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev);
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
int result;
u32 rh_a;
Expand Down Expand Up @@ -171,7 +171,7 @@ static int ohci_da8xx_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
u16 wIndex, char *buf, u16 wLength)
{
struct device *dev = hcd->self.controller;
struct da8xx_ohci_root_hub *hub = dev->platform_data;
struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev);
int temp;

switch (typeReq) {
Expand Down Expand Up @@ -292,7 +292,7 @@ static const struct hc_driver ohci_da8xx_hc_driver = {
static int usb_hcd_da8xx_probe(const struct hc_driver *driver,
struct platform_device *pdev)
{
struct da8xx_ohci_root_hub *hub = pdev->dev.platform_data;
struct da8xx_ohci_root_hub *hub = dev_get_platdata(&pdev->dev);
struct usb_hcd *hcd;
struct resource *mem;
int error, irq;
Expand Down Expand Up @@ -380,7 +380,7 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver,
static inline void
usb_hcd_da8xx_remove(struct usb_hcd *hcd, struct platform_device *pdev)
{
struct da8xx_ohci_root_hub *hub = pdev->dev.platform_data;
struct da8xx_ohci_root_hub *hub = dev_get_platdata(&pdev->dev);

hub->ocic_notify(NULL);
usb_remove_hcd(hcd);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ohci-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static const struct hc_driver exynos_ohci_hc_driver = {

static int exynos_ohci_probe(struct platform_device *pdev)
{
struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
struct exynos4_ohci_platdata *pdata = dev_get_platdata(&pdev->dev);
struct exynos_ohci_hcd *exynos_ohci;
struct usb_hcd *hcd;
struct ohci_hcd *ohci;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/host/ohci-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static void start_hnp(struct ohci_hcd *ohci)
static int ohci_omap_init(struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
struct omap_usb_config *config = hcd->self.controller->platform_data;
struct omap_usb_config *config = dev_get_platdata(hcd->self.controller);
int need_transceiver = (config->otg != 0);
int ret;

Expand Down Expand Up @@ -427,7 +427,7 @@ ohci_omap_start (struct usb_hcd *hcd)

if (!host_enabled)
return 0;
config = hcd->self.controller->platform_data;
config = dev_get_platdata(hcd->self.controller);
if (config->otg || config->rwc) {
ohci->hc_control = OHCI_CTRL_RWC;
writel(OHCI_CTRL_RWC, &ohci->regs->control);
Expand Down
Loading

0 comments on commit d4f09e2

Please sign in to comment.