| .. | .. |
|---|
| 68 | 68 | static ssize_t reg_store(struct device *dev, struct device_attribute *attr, |
|---|
| 69 | 69 | const char *buf, size_t count); |
|---|
| 70 | 70 | |
|---|
| 71 | | -DEVICE_ATTR(reg_br, S_IRUGO|S_IWUSR|S_IWGRP, reg_show, reg_store); |
|---|
| 72 | | -DEVICE_ATTR(reg_or, S_IRUGO|S_IWUSR|S_IWGRP, reg_show, reg_store); |
|---|
| 71 | +static DEVICE_ATTR(reg_br, 0664, reg_show, reg_store); |
|---|
| 72 | +static DEVICE_ATTR(reg_or, 0664, reg_show, reg_store); |
|---|
| 73 | + |
|---|
| 74 | +static struct attribute *uio_fsl_elbc_gpcm_attrs[] = { |
|---|
| 75 | + &dev_attr_reg_br.attr, |
|---|
| 76 | + &dev_attr_reg_or.attr, |
|---|
| 77 | + NULL, |
|---|
| 78 | +}; |
|---|
| 79 | +ATTRIBUTE_GROUPS(uio_fsl_elbc_gpcm); |
|---|
| 73 | 80 | |
|---|
| 74 | 81 | static ssize_t reg_show(struct device *dev, struct device_attribute *attr, |
|---|
| 75 | 82 | char *buf) |
|---|
| 76 | 83 | { |
|---|
| 77 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 78 | | - struct uio_info *info = platform_get_drvdata(pdev); |
|---|
| 84 | + struct uio_info *info = dev_get_drvdata(dev); |
|---|
| 79 | 85 | struct fsl_elbc_gpcm *priv = info->priv; |
|---|
| 80 | 86 | struct fsl_lbc_bank *bank = &priv->lbc->bank[priv->bank]; |
|---|
| 81 | 87 | |
|---|
| .. | .. |
|---|
| 94 | 100 | static ssize_t reg_store(struct device *dev, struct device_attribute *attr, |
|---|
| 95 | 101 | const char *buf, size_t count) |
|---|
| 96 | 102 | { |
|---|
| 97 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 98 | | - struct uio_info *info = platform_get_drvdata(pdev); |
|---|
| 103 | + struct uio_info *info = dev_get_drvdata(dev); |
|---|
| 99 | 104 | struct fsl_elbc_gpcm *priv = info->priv; |
|---|
| 100 | 105 | struct fsl_lbc_bank *bank = &priv->lbc->bank[priv->bank]; |
|---|
| 101 | 106 | unsigned long val; |
|---|
| .. | .. |
|---|
| 382 | 387 | } |
|---|
| 383 | 388 | |
|---|
| 384 | 389 | /* set all UIO data */ |
|---|
| 385 | | - if (node->name) |
|---|
| 386 | | - info->mem[0].name = kstrdup(node->name, GFP_KERNEL); |
|---|
| 390 | + info->mem[0].name = kasprintf(GFP_KERNEL, "%pOFn", node); |
|---|
| 387 | 391 | info->mem[0].addr = res.start; |
|---|
| 388 | 392 | info->mem[0].size = resource_size(&res); |
|---|
| 389 | 393 | info->mem[0].memtype = UIO_MEM_PHYS; |
|---|
| .. | .. |
|---|
| 414 | 418 | /* store private data */ |
|---|
| 415 | 419 | platform_set_drvdata(pdev, info); |
|---|
| 416 | 420 | |
|---|
| 417 | | - /* create sysfs files */ |
|---|
| 418 | | - ret = device_create_file(priv->dev, &dev_attr_reg_br); |
|---|
| 419 | | - if (ret) |
|---|
| 420 | | - goto out_err3; |
|---|
| 421 | | - ret = device_create_file(priv->dev, &dev_attr_reg_or); |
|---|
| 422 | | - if (ret) |
|---|
| 423 | | - goto out_err4; |
|---|
| 424 | | - |
|---|
| 425 | 421 | dev_info(priv->dev, |
|---|
| 426 | 422 | "eLBC/GPCM device (%s) at 0x%llx, bank %d, irq=%d\n", |
|---|
| 427 | 423 | priv->name, (unsigned long long)res.start, priv->bank, |
|---|
| 428 | 424 | irq != NO_IRQ ? irq : -1); |
|---|
| 429 | 425 | |
|---|
| 430 | 426 | return 0; |
|---|
| 431 | | -out_err4: |
|---|
| 432 | | - device_remove_file(priv->dev, &dev_attr_reg_br); |
|---|
| 433 | | -out_err3: |
|---|
| 434 | | - platform_set_drvdata(pdev, NULL); |
|---|
| 435 | | - uio_unregister_device(info); |
|---|
| 436 | 427 | out_err2: |
|---|
| 437 | 428 | if (priv->shutdown) |
|---|
| 438 | 429 | priv->shutdown(info, true); |
|---|
| .. | .. |
|---|
| 451 | 442 | struct uio_info *info = platform_get_drvdata(pdev); |
|---|
| 452 | 443 | struct fsl_elbc_gpcm *priv = info->priv; |
|---|
| 453 | 444 | |
|---|
| 454 | | - device_remove_file(priv->dev, &dev_attr_reg_or); |
|---|
| 455 | | - device_remove_file(priv->dev, &dev_attr_reg_br); |
|---|
| 456 | 445 | platform_set_drvdata(pdev, NULL); |
|---|
| 457 | 446 | uio_unregister_device(info); |
|---|
| 458 | 447 | if (priv->shutdown) |
|---|
| .. | .. |
|---|
| 477 | 466 | .driver = { |
|---|
| 478 | 467 | .name = "fsl,elbc-gpcm-uio", |
|---|
| 479 | 468 | .of_match_table = uio_fsl_elbc_gpcm_match, |
|---|
| 469 | + .dev_groups = uio_fsl_elbc_gpcm_groups, |
|---|
| 480 | 470 | }, |
|---|
| 481 | 471 | .probe = uio_fsl_elbc_gpcm_probe, |
|---|
| 482 | 472 | .remove = uio_fsl_elbc_gpcm_remove, |
|---|