device.c (d200781ef237a354d918ceff5cee350d88a93d42) | device.c (730926c3b0998943654019f00296cf8e3b02277e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright(c) 2016-2018 Intel Corporation. All rights reserved. */ 3#include <linux/memremap.h> 4#include <linux/pagemap.h> 5#include <linux/module.h> 6#include <linux/device.h> 7#include <linux/pfn_t.h> 8#include <linux/cdev.h> --- 431 unchanged lines hidden (view full) --- 440 cdev_del(cdev); 441} 442 443static void dev_dax_kill(void *dev_dax) 444{ 445 kill_dev_dax(dev_dax); 446} 447 | 1// SPDX-License-Identifier: GPL-2.0 2/* Copyright(c) 2016-2018 Intel Corporation. All rights reserved. */ 3#include <linux/memremap.h> 4#include <linux/pagemap.h> 5#include <linux/module.h> 6#include <linux/device.h> 7#include <linux/pfn_t.h> 8#include <linux/cdev.h> --- 431 unchanged lines hidden (view full) --- 440 cdev_del(cdev); 441} 442 443static void dev_dax_kill(void *dev_dax) 444{ 445 kill_dev_dax(dev_dax); 446} 447 |
448static int dev_dax_probe(struct device *dev) | 448int dev_dax_probe(struct device *dev) |
449{ 450 struct dev_dax *dev_dax = to_dev_dax(dev); 451 struct dax_device *dax_dev = dev_dax->dax_dev; 452 struct resource *res = &dev_dax->region->res; 453 struct inode *inode; 454 struct cdev *cdev; 455 void *addr; 456 int rc; --- 22 unchanged lines hidden (view full) --- 479 devm_remove_action(dev, dev_dax_percpu_exit, &dev_dax->ref); 480 percpu_ref_exit(&dev_dax->ref); 481 return PTR_ERR(addr); 482 } 483 484 inode = dax_inode(dax_dev); 485 cdev = inode->i_cdev; 486 cdev_init(cdev, &dax_fops); | 449{ 450 struct dev_dax *dev_dax = to_dev_dax(dev); 451 struct dax_device *dax_dev = dev_dax->dax_dev; 452 struct resource *res = &dev_dax->region->res; 453 struct inode *inode; 454 struct cdev *cdev; 455 void *addr; 456 int rc; --- 22 unchanged lines hidden (view full) --- 479 devm_remove_action(dev, dev_dax_percpu_exit, &dev_dax->ref); 480 percpu_ref_exit(&dev_dax->ref); 481 return PTR_ERR(addr); 482 } 483 484 inode = dax_inode(dax_dev); 485 cdev = inode->i_cdev; 486 cdev_init(cdev, &dax_fops); |
487 cdev->owner = dev->driver->owner; | 487 if (dev->class) { 488 /* for the CONFIG_DEV_DAX_PMEM_COMPAT case */ 489 cdev->owner = dev->parent->driver->owner; 490 } else 491 cdev->owner = dev->driver->owner; |
488 cdev_set_parent(cdev, &dev->kobj); 489 rc = cdev_add(cdev, dev->devt, 1); 490 if (rc) 491 return rc; 492 493 rc = devm_add_action_or_reset(dev, dev_dax_cdev_del, cdev); 494 if (rc) 495 return rc; 496 497 run_dax(dax_dev); 498 return devm_add_action_or_reset(dev, dev_dax_kill, dev_dax); 499} | 492 cdev_set_parent(cdev, &dev->kobj); 493 rc = cdev_add(cdev, dev->devt, 1); 494 if (rc) 495 return rc; 496 497 rc = devm_add_action_or_reset(dev, dev_dax_cdev_del, cdev); 498 if (rc) 499 return rc; 500 501 run_dax(dax_dev); 502 return devm_add_action_or_reset(dev, dev_dax_kill, dev_dax); 503} |
504EXPORT_SYMBOL_GPL(dev_dax_probe); |
|
500 501static int dev_dax_remove(struct device *dev) 502{ 503 /* all probe actions are unwound by devm */ 504 return 0; 505} 506 507static struct dax_device_driver device_dax_driver = { --- 22 unchanged lines hidden --- | 505 506static int dev_dax_remove(struct device *dev) 507{ 508 /* all probe actions are unwound by devm */ 509 return 0; 510} 511 512static struct dax_device_driver device_dax_driver = { --- 22 unchanged lines hidden --- |