aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 06:13:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 06:13:59 -0400
commit2d03423b2319cc854adeb28a03f65de5b5e0ab63 (patch)
tree20d9ddb661f3247f5dfaa6da8212123ed14a24c4 /drivers
parent59e52534172d845ebffb0d7e85fc56fb7b857051 (diff)
parent2bbcb8788311a40714b585fc11b51da6ffa2ab92 (diff)
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (38 commits) mm: memory hotplug: Check if pages are correctly reserved on a per-section basis Revert "memory hotplug: Correct page reservation checking" Update email address for stable patch submission dynamic_debug: fix undefined reference to `__netdev_printk' dynamic_debug: use a single printk() to emit messages dynamic_debug: remove num_enabled accounting dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions uio: Support physical addresses >32 bits on 32-bit systems sysfs: add unsigned long cast to prevent compile warning drivers: base: print rejected matches with DEBUG_DRIVER memory hotplug: Correct page reservation checking memory hotplug: Refuse to add unaligned memory regions remove the messy code file Documentation/zh_CN/SubmitChecklist ARM: mxc: convert device creation to use platform_device_register_full new helper to create platform devices with dma mask docs/driver-model: Update device class docs docs/driver-model: Document device.groups kobj_uevent: Ignore if some listeners cannot handle message dynamic_debug: make netif_dbg() call __netdev_printk() dynamic_debug: make netdev_dbg() call __netdev_printk() ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c5
-rw-r--r--drivers/base/dd.c3
-rw-r--r--drivers/base/memory.c62
-rw-r--r--drivers/base/platform.c54
-rw-r--r--drivers/misc/pch_phub.c10
-rw-r--r--drivers/uio/uio.c14
-rw-r--r--drivers/uio/uio_pci_generic.c5
-rw-r--r--drivers/uio/uio_pdrv_genirq.c2
8 files changed, 98 insertions, 57 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bc8729d603a7..82c865452c70 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1764,8 +1764,8 @@ void device_shutdown(void)
1764 1764
1765#ifdef CONFIG_PRINTK 1765#ifdef CONFIG_PRINTK
1766 1766
1767static int __dev_printk(const char *level, const struct device *dev, 1767int __dev_printk(const char *level, const struct device *dev,
1768 struct va_format *vaf) 1768 struct va_format *vaf)
1769{ 1769{
1770 if (!dev) 1770 if (!dev)
1771 return printk("%s(NULL device *): %pV", level, vaf); 1771 return printk("%s(NULL device *): %pV", level, vaf);
@@ -1773,6 +1773,7 @@ static int __dev_printk(const char *level, const struct device *dev,
1773 return printk("%s%s %s: %pV", 1773 return printk("%s%s %s: %pV",
1774 level, dev_driver_string(dev), dev_name(dev), vaf); 1774 level, dev_driver_string(dev), dev_name(dev), vaf);
1775} 1775}
1776EXPORT_SYMBOL(__dev_printk);
1776 1777
1777int dev_printk(const char *level, const struct device *dev, 1778int dev_printk(const char *level, const struct device *dev,
1778 const char *fmt, ...) 1779 const char *fmt, ...)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 6658da743c3a..142e3d600f14 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -147,6 +147,9 @@ probe_failed:
147 printk(KERN_WARNING 147 printk(KERN_WARNING
148 "%s: probe of %s failed with error %d\n", 148 "%s: probe of %s failed with error %d\n",
149 drv->name, dev_name(dev), ret); 149 drv->name, dev_name(dev), ret);
150 } else {
151 pr_debug("%s: probe of %s rejects match %d\n",
152 drv->name, dev_name(dev), ret);
150 } 153 }
151 /* 154 /*
152 * Ignore errors returned by ->probe so that the next driver can try 155 * Ignore errors returned by ->probe so that the next driver can try
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2840ed4668c1..8272d92d22c0 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -224,13 +224,48 @@ int memory_isolate_notify(unsigned long val, void *v)
224} 224}
225 225
226/* 226/*
227 * The probe routines leave the pages reserved, just as the bootmem code does.
228 * Make sure they're still that way.
229 */
230static bool pages_correctly_reserved(unsigned long start_pfn,
231 unsigned long nr_pages)
232{
233 int i, j;
234 struct page *page;
235 unsigned long pfn = start_pfn;
236
237 /*
238 * memmap between sections is not contiguous except with
239 * SPARSEMEM_VMEMMAP. We lookup the page once per section
240 * and assume memmap is contiguous within each section
241 */
242 for (i = 0; i < sections_per_block; i++, pfn += PAGES_PER_SECTION) {
243 if (WARN_ON_ONCE(!pfn_valid(pfn)))
244 return false;
245 page = pfn_to_page(pfn);
246
247 for (j = 0; j < PAGES_PER_SECTION; j++) {
248 if (PageReserved(page + j))
249 continue;
250
251 printk(KERN_WARNING "section number %ld page number %d "
252 "not reserved, was it already online?\n",
253 pfn_to_section_nr(pfn), j);
254
255 return false;
256 }
257 }
258
259 return true;
260}
261
262/*
227 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is 263 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is
228 * OK to have direct references to sparsemem variables in here. 264 * OK to have direct references to sparsemem variables in here.
229 */ 265 */
230static int 266static int
231memory_block_action(unsigned long phys_index, unsigned long action) 267memory_block_action(unsigned long phys_index, unsigned long action)
232{ 268{
233 int i;
234 unsigned long start_pfn, start_paddr; 269 unsigned long start_pfn, start_paddr;
235 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; 270 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
236 struct page *first_page; 271 struct page *first_page;
@@ -238,26 +273,13 @@ memory_block_action(unsigned long phys_index, unsigned long action)
238 273
239 first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); 274 first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT);
240 275
241 /*
242 * The probe routines leave the pages reserved, just
243 * as the bootmem code does. Make sure they're still
244 * that way.
245 */
246 if (action == MEM_ONLINE) {
247 for (i = 0; i < nr_pages; i++) {
248 if (PageReserved(first_page+i))
249 continue;
250
251 printk(KERN_WARNING "section number %ld page number %d "
252 "not reserved, was it already online?\n",
253 phys_index, i);
254 return -EBUSY;
255 }
256 }
257
258 switch (action) { 276 switch (action) {
259 case MEM_ONLINE: 277 case MEM_ONLINE:
260 start_pfn = page_to_pfn(first_page); 278 start_pfn = page_to_pfn(first_page);
279
280 if (!pages_correctly_reserved(start_pfn, nr_pages))
281 return -EBUSY;
282
261 ret = online_pages(start_pfn, nr_pages); 283 ret = online_pages(start_pfn, nr_pages);
262 break; 284 break;
263 case MEM_OFFLINE: 285 case MEM_OFFLINE:
@@ -380,9 +402,13 @@ memory_probe_store(struct class *class, struct class_attribute *attr,
380 u64 phys_addr; 402 u64 phys_addr;
381 int nid; 403 int nid;
382 int i, ret; 404 int i, ret;
405 unsigned long pages_per_block = PAGES_PER_SECTION * sections_per_block;
383 406
384 phys_addr = simple_strtoull(buf, NULL, 0); 407 phys_addr = simple_strtoull(buf, NULL, 0);
385 408
409 if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1))
410 return -EINVAL;
411
386 for (i = 0; i < sections_per_block; i++) { 412 for (i = 0; i < sections_per_block; i++) {
387 nid = memory_add_physaddr_to_nid(phys_addr); 413 nid = memory_add_physaddr_to_nid(phys_addr);
388 ret = add_memory(nid, phys_addr, 414 ret = add_memory(nid, phys_addr,
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 99a5272d7c2f..7a24895543e7 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -375,52 +375,64 @@ void platform_device_unregister(struct platform_device *pdev)
375EXPORT_SYMBOL_GPL(platform_device_unregister); 375EXPORT_SYMBOL_GPL(platform_device_unregister);
376 376
377/** 377/**
378 * platform_device_register_resndata - add a platform-level device with 378 * platform_device_register_full - add a platform-level device with
379 * resources and platform-specific data 379 * resources and platform-specific data
380 * 380 *
381 * @parent: parent device for the device we're adding 381 * @pdevinfo: data used to create device
382 * @name: base name of the device we're adding
383 * @id: instance id
384 * @res: set of resources that needs to be allocated for the device
385 * @num: number of resources
386 * @data: platform specific data for this platform device
387 * @size: size of platform specific data
388 * 382 *
389 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 383 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
390 */ 384 */
391struct platform_device *platform_device_register_resndata( 385struct platform_device *platform_device_register_full(
392 struct device *parent, 386 struct platform_device_info *pdevinfo)
393 const char *name, int id,
394 const struct resource *res, unsigned int num,
395 const void *data, size_t size)
396{ 387{
397 int ret = -ENOMEM; 388 int ret = -ENOMEM;
398 struct platform_device *pdev; 389 struct platform_device *pdev;
399 390
400 pdev = platform_device_alloc(name, id); 391 pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
401 if (!pdev) 392 if (!pdev)
402 goto err; 393 goto err_alloc;
403 394
404 pdev->dev.parent = parent; 395 pdev->dev.parent = pdevinfo->parent;
396
397 if (pdevinfo->dma_mask) {
398 /*
399 * This memory isn't freed when the device is put,
400 * I don't have a nice idea for that though. Conceptually
401 * dma_mask in struct device should not be a pointer.
402 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
403 */
404 pdev->dev.dma_mask =
405 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
406 if (!pdev->dev.dma_mask)
407 goto err;
408
409 *pdev->dev.dma_mask = pdevinfo->dma_mask;
410 pdev->dev.coherent_dma_mask = pdevinfo->dma_mask;
411 }
405 412
406 ret = platform_device_add_resources(pdev, res, num); 413 ret = platform_device_add_resources(pdev,
414 pdevinfo->res, pdevinfo->num_res);
407 if (ret) 415 if (ret)
408 goto err; 416 goto err;
409 417
410 ret = platform_device_add_data(pdev, data, size); 418 ret = platform_device_add_data(pdev,
419 pdevinfo->data, pdevinfo->size_data);
411 if (ret) 420 if (ret)
412 goto err; 421 goto err;
413 422
414 ret = platform_device_add(pdev); 423 ret = platform_device_add(pdev);
415 if (ret) { 424 if (ret) {
416err: 425err:
426 kfree(pdev->dev.dma_mask);
427
428err_alloc:
417 platform_device_put(pdev); 429 platform_device_put(pdev);
418 return ERR_PTR(ret); 430 return ERR_PTR(ret);
419 } 431 }
420 432
421 return pdev; 433 return pdev;
422} 434}
423EXPORT_SYMBOL_GPL(platform_device_register_resndata); 435EXPORT_SYMBOL_GPL(platform_device_register_full);
424 436
425static int platform_drv_probe(struct device *_dev) 437static int platform_drv_probe(struct device *_dev)
426{ 438{
@@ -614,7 +626,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
614 return rc; 626 return rc;
615 627
616 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, 628 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
617 (pdev->id_entry) ? pdev->id_entry->name : pdev->name); 629 pdev->name);
618 return 0; 630 return 0;
619} 631}
620 632
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 0fd7e77bee29..dee33addcaeb 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -90,6 +90,7 @@
90#define PCH_PHUB_INTPIN_REG_WPERMIT_REG3 0x002C 90#define PCH_PHUB_INTPIN_REG_WPERMIT_REG3 0x002C
91#define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE 0x0040 91#define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE 0x0040
92#define CLKCFG_REG_OFFSET 0x500 92#define CLKCFG_REG_OFFSET 0x500
93#define FUNCSEL_REG_OFFSET 0x508
93 94
94#define PCH_PHUB_OROM_SIZE 15360 95#define PCH_PHUB_OROM_SIZE 15360
95 96
@@ -108,6 +109,7 @@
108 * @intpin_reg_wpermit_reg3: INTPIN_REG_WPERMIT register 3 val 109 * @intpin_reg_wpermit_reg3: INTPIN_REG_WPERMIT register 3 val
109 * @int_reduce_control_reg: INT_REDUCE_CONTROL registers val 110 * @int_reduce_control_reg: INT_REDUCE_CONTROL registers val
110 * @clkcfg_reg: CLK CFG register val 111 * @clkcfg_reg: CLK CFG register val
112 * @funcsel_reg: Function select register value
111 * @pch_phub_base_address: Register base address 113 * @pch_phub_base_address: Register base address
112 * @pch_phub_extrom_base_address: external rom base address 114 * @pch_phub_extrom_base_address: external rom base address
113 * @pch_mac_start_address: MAC address area start address 115 * @pch_mac_start_address: MAC address area start address
@@ -128,6 +130,7 @@ struct pch_phub_reg {
128 u32 intpin_reg_wpermit_reg3; 130 u32 intpin_reg_wpermit_reg3;
129 u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG]; 131 u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG];
130 u32 clkcfg_reg; 132 u32 clkcfg_reg;
133 u32 funcsel_reg;
131 void __iomem *pch_phub_base_address; 134 void __iomem *pch_phub_base_address;
132 void __iomem *pch_phub_extrom_base_address; 135 void __iomem *pch_phub_extrom_base_address;
133 u32 pch_mac_start_address; 136 u32 pch_mac_start_address;
@@ -211,6 +214,8 @@ static void pch_phub_save_reg_conf(struct pci_dev *pdev)
211 __func__, i, chip->int_reduce_control_reg[i]); 214 __func__, i, chip->int_reduce_control_reg[i]);
212 } 215 }
213 chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET); 216 chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET);
217 if ((chip->ioh_type == 2) || (chip->ioh_type == 4))
218 chip->funcsel_reg = ioread32(p + FUNCSEL_REG_OFFSET);
214} 219}
215 220
216/* pch_phub_restore_reg_conf - restore register configuration */ 221/* pch_phub_restore_reg_conf - restore register configuration */
@@ -271,6 +276,8 @@ static void pch_phub_restore_reg_conf(struct pci_dev *pdev)
271 } 276 }
272 277
273 iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET); 278 iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET);
279 if ((chip->ioh_type == 2) || (chip->ioh_type == 4))
280 iowrite32(chip->funcsel_reg, p + FUNCSEL_REG_OFFSET);
274} 281}
275 282
276/** 283/**
@@ -594,8 +601,7 @@ static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr,
594 601
595 pch_phub_read_gbe_mac_addr(chip, mac); 602 pch_phub_read_gbe_mac_addr(chip, mac);
596 603
597 return sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x\n", 604 return sprintf(buf, "%pM\n", mac);
598 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
599} 605}
600 606
601static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, 607static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr,
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index d2efe823c20d..a783d533a1a6 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -69,7 +69,7 @@ static ssize_t map_name_show(struct uio_mem *mem, char *buf)
69 69
70static ssize_t map_addr_show(struct uio_mem *mem, char *buf) 70static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
71{ 71{
72 return sprintf(buf, "0x%lx\n", mem->addr); 72 return sprintf(buf, "0x%llx\n", (unsigned long long)mem->addr);
73} 73}
74 74
75static ssize_t map_size_show(struct uio_mem *mem, char *buf) 75static ssize_t map_size_show(struct uio_mem *mem, char *buf)
@@ -79,7 +79,7 @@ static ssize_t map_size_show(struct uio_mem *mem, char *buf)
79 79
80static ssize_t map_offset_show(struct uio_mem *mem, char *buf) 80static ssize_t map_offset_show(struct uio_mem *mem, char *buf)
81{ 81{
82 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK); 82 return sprintf(buf, "0x%llx\n", (unsigned long long)mem->addr & ~PAGE_MASK);
83} 83}
84 84
85struct map_sysfs_entry { 85struct map_sysfs_entry {
@@ -634,8 +634,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
634 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) 634 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
635 page = virt_to_page(idev->info->mem[mi].addr + offset); 635 page = virt_to_page(idev->info->mem[mi].addr + offset);
636 else 636 else
637 page = vmalloc_to_page((void *)idev->info->mem[mi].addr 637 page = vmalloc_to_page((void *)(unsigned long)idev->info->mem[mi].addr + offset);
638 + offset);
639 get_page(page); 638 get_page(page);
640 vmf->page = page; 639 vmf->page = page;
641 return 0; 640 return 0;
@@ -750,14 +749,13 @@ static int uio_major_init(void)
750 749
751 uio_major = MAJOR(uio_dev); 750 uio_major = MAJOR(uio_dev);
752 uio_cdev = cdev; 751 uio_cdev = cdev;
753 result = 0; 752 return 0;
754out:
755 return result;
756out_put: 753out_put:
757 kobject_put(&cdev->kobj); 754 kobject_put(&cdev->kobj);
758out_unregister: 755out_unregister:
759 unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES); 756 unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES);
760 goto out; 757out:
758 return result;
761} 759}
762 760
763static void uio_major_cleanup(void) 761static void uio_major_cleanup(void)
diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index fc22e1e6f215..02bd47bdee1c 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -24,7 +24,6 @@
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/uio_driver.h> 26#include <linux/uio_driver.h>
27#include <linux/spinlock.h>
28 27
29#define DRIVER_VERSION "0.01.0" 28#define DRIVER_VERSION "0.01.0"
30#define DRIVER_AUTHOR "Michael S. Tsirkin <mst@redhat.com>" 29#define DRIVER_AUTHOR "Michael S. Tsirkin <mst@redhat.com>"
@@ -33,7 +32,6 @@
33struct uio_pci_generic_dev { 32struct uio_pci_generic_dev {
34 struct uio_info info; 33 struct uio_info info;
35 struct pci_dev *pdev; 34 struct pci_dev *pdev;
36 spinlock_t lock; /* guards command register accesses */
37}; 35};
38 36
39static inline struct uio_pci_generic_dev * 37static inline struct uio_pci_generic_dev *
@@ -57,7 +55,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
57 BUILD_BUG_ON(PCI_COMMAND % 4); 55 BUILD_BUG_ON(PCI_COMMAND % 4);
58 BUILD_BUG_ON(PCI_COMMAND + 2 != PCI_STATUS); 56 BUILD_BUG_ON(PCI_COMMAND + 2 != PCI_STATUS);
59 57
60 spin_lock_irq(&gdev->lock);
61 pci_block_user_cfg_access(pdev); 58 pci_block_user_cfg_access(pdev);
62 59
63 /* Read both command and status registers in a single 32-bit operation. 60 /* Read both command and status registers in a single 32-bit operation.
@@ -83,7 +80,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
83done: 80done:
84 81
85 pci_unblock_user_cfg_access(pdev); 82 pci_unblock_user_cfg_access(pdev);
86 spin_unlock_irq(&gdev->lock);
87 return ret; 83 return ret;
88} 84}
89 85
@@ -158,7 +154,6 @@ static int __devinit probe(struct pci_dev *pdev,
158 gdev->info.irq_flags = IRQF_SHARED; 154 gdev->info.irq_flags = IRQF_SHARED;
159 gdev->info.handler = irqhandler; 155 gdev->info.handler = irqhandler;
160 gdev->pdev = pdev; 156 gdev->pdev = pdev;
161 spin_lock_init(&gdev->lock);
162 157
163 if (uio_register_device(&pdev->dev, &gdev->info)) 158 if (uio_register_device(&pdev->dev, &gdev->info))
164 goto err_register; 159 goto err_register;
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index bae96d246760..0b2ed71e3bfa 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -253,7 +253,7 @@ static const struct dev_pm_ops uio_pdrv_genirq_dev_pm_ops = {
253}; 253};
254 254
255#ifdef CONFIG_OF 255#ifdef CONFIG_OF
256static const struct of_device_id __devinitconst uio_of_genirq_match[] = { 256static const struct of_device_id uio_of_genirq_match[] = {
257 { /* empty for now */ }, 257 { /* empty for now */ },
258}; 258};
259MODULE_DEVICE_TABLE(of, uio_of_genirq_match); 259MODULE_DEVICE_TABLE(of, uio_of_genirq_match);