aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-26 13:13:19 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-26 13:13:19 -0400
commitc226951b93f7cd7c3a10b17384535b617bd43fd0 (patch)
tree07b8796a5c99fbbf587b8d0dbcbc173cfe5e381e /drivers
parentb0df3bd1e553e901ec7297267611a5db88240b38 (diff)
parente8216dee838c09776680a6f1a2e54d81f3cdfa14 (diff)
Merge branch 'master' into upstream
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/sata_nv.c6
-rw-r--r--drivers/ata/sata_sis.c6
-rw-r--r--drivers/ata/sata_uli.c6
-rw-r--r--drivers/ata/sata_via.c7
-rw-r--r--drivers/atm/he.c16
-rw-r--r--drivers/base/node.c13
-rw-r--r--drivers/char/rtc.c5
-rw-r--r--drivers/ide/mips/au1xxx-ide.c4
-rw-r--r--drivers/media/video/videodev.c2
-rw-r--r--drivers/mmc/au1xmmc.c2
-rw-r--r--drivers/net/sunlance.c10
-rw-r--r--drivers/serial/serial_core.c14
-rw-r--r--drivers/video/fbsysfs.c12
14 files changed, 71 insertions, 34 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index ab2ecccf7798..ffa111eea9da 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -851,7 +851,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
851 * @ap: Port whose timings we are configuring 851 * @ap: Port whose timings we are configuring
852 * @adev: Drive in question 852 * @adev: Drive in question
853 * @udma: udma mode, 0 - 6 853 * @udma: udma mode, 0 - 6
854 * @is_ich: set if the chip is an ICH device 854 * @isich: set if the chip is an ICH device
855 * 855 *
856 * Set UDMA mode for device, in host controller PCI config space. 856 * Set UDMA mode for device, in host controller PCI config space.
857 * 857 *
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 27c22feebf30..8cd730fe5dd3 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -484,7 +484,7 @@ static void nv_error_handler(struct ata_port *ap)
484static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 484static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
485{ 485{
486 static int printed_version = 0; 486 static int printed_version = 0;
487 struct ata_port_info *ppi; 487 struct ata_port_info *ppi[2];
488 struct ata_probe_ent *probe_ent; 488 struct ata_probe_ent *probe_ent;
489 int pci_dev_busy = 0; 489 int pci_dev_busy = 0;
490 int rc; 490 int rc;
@@ -520,8 +520,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
520 520
521 rc = -ENOMEM; 521 rc = -ENOMEM;
522 522
523 ppi = &nv_port_info[ent->driver_data]; 523 ppi[0] = ppi[1] = &nv_port_info[ent->driver_data];
524 probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 524 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
525 if (!probe_ent) 525 if (!probe_ent)
526 goto err_out_regions; 526 goto err_out_regions;
527 527
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 9b17375d8056..18d49fff8dc4 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -240,7 +240,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
240 struct ata_probe_ent *probe_ent = NULL; 240 struct ata_probe_ent *probe_ent = NULL;
241 int rc; 241 int rc;
242 u32 genctl; 242 u32 genctl;
243 struct ata_port_info *ppi; 243 struct ata_port_info *ppi[2];
244 int pci_dev_busy = 0; 244 int pci_dev_busy = 0;
245 u8 pmr; 245 u8 pmr;
246 u8 port2_start; 246 u8 port2_start;
@@ -265,8 +265,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
265 if (rc) 265 if (rc)
266 goto err_out_regions; 266 goto err_out_regions;
267 267
268 ppi = &sis_port_info; 268 ppi[0] = ppi[1] = &sis_port_info;
269 probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 269 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
270 if (!probe_ent) { 270 if (!probe_ent) {
271 rc = -ENOMEM; 271 rc = -ENOMEM;
272 goto err_out_regions; 272 goto err_out_regions;
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 8fc6e800011a..dd76f37be182 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -185,7 +185,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
185{ 185{
186 static int printed_version; 186 static int printed_version;
187 struct ata_probe_ent *probe_ent; 187 struct ata_probe_ent *probe_ent;
188 struct ata_port_info *ppi; 188 struct ata_port_info *ppi[2];
189 int rc; 189 int rc;
190 unsigned int board_idx = (unsigned int) ent->driver_data; 190 unsigned int board_idx = (unsigned int) ent->driver_data;
191 int pci_dev_busy = 0; 191 int pci_dev_busy = 0;
@@ -211,8 +211,8 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
211 if (rc) 211 if (rc)
212 goto err_out_regions; 212 goto err_out_regions;
213 213
214 ppi = &uli_port_info; 214 ppi[0] = ppi[1] = &uli_port_info;
215 probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 215 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
216 if (!probe_ent) { 216 if (!probe_ent) {
217 rc = -ENOMEM; 217 rc = -ENOMEM;
218 goto err_out_regions; 218 goto err_out_regions;
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 7f087aef99de..a72a2389a11c 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -318,9 +318,10 @@ static void vt6421_init_addrs(struct ata_probe_ent *probe_ent,
318static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev) 318static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
319{ 319{
320 struct ata_probe_ent *probe_ent; 320 struct ata_probe_ent *probe_ent;
321 struct ata_port_info *ppi = &vt6420_port_info; 321 struct ata_port_info *ppi[2];
322 322
323 probe_ent = ata_pci_init_native_mode(pdev, &ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 323 ppi[0] = ppi[1] = &vt6420_port_info;
324 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
324 if (!probe_ent) 325 if (!probe_ent)
325 return NULL; 326 return NULL;
326 327
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 41e052fecd7f..f2511b42dba2 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -454,7 +454,7 @@ rate_to_atmf(unsigned rate) /* cps to atm forum format */
454 return (NONZERO | (exp << 9) | (rate & 0x1ff)); 454 return (NONZERO | (exp << 9) | (rate & 0x1ff));
455} 455}
456 456
457static void __init 457static void __devinit
458he_init_rx_lbfp0(struct he_dev *he_dev) 458he_init_rx_lbfp0(struct he_dev *he_dev)
459{ 459{
460 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 460 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -485,7 +485,7 @@ he_init_rx_lbfp0(struct he_dev *he_dev)
485 he_writel(he_dev, he_dev->r0_numbuffs, RLBF0_C); 485 he_writel(he_dev, he_dev->r0_numbuffs, RLBF0_C);
486} 486}
487 487
488static void __init 488static void __devinit
489he_init_rx_lbfp1(struct he_dev *he_dev) 489he_init_rx_lbfp1(struct he_dev *he_dev)
490{ 490{
491 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 491 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -516,7 +516,7 @@ he_init_rx_lbfp1(struct he_dev *he_dev)
516 he_writel(he_dev, he_dev->r1_numbuffs, RLBF1_C); 516 he_writel(he_dev, he_dev->r1_numbuffs, RLBF1_C);
517} 517}
518 518
519static void __init 519static void __devinit
520he_init_tx_lbfp(struct he_dev *he_dev) 520he_init_tx_lbfp(struct he_dev *he_dev)
521{ 521{
522 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 522 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -546,7 +546,7 @@ he_init_tx_lbfp(struct he_dev *he_dev)
546 he_writel(he_dev, lbufd_index - 1, TLBF_T); 546 he_writel(he_dev, lbufd_index - 1, TLBF_T);
547} 547}
548 548
549static int __init 549static int __devinit
550he_init_tpdrq(struct he_dev *he_dev) 550he_init_tpdrq(struct he_dev *he_dev)
551{ 551{
552 he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev, 552 he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev,
@@ -568,7 +568,7 @@ he_init_tpdrq(struct he_dev *he_dev)
568 return 0; 568 return 0;
569} 569}
570 570
571static void __init 571static void __devinit
572he_init_cs_block(struct he_dev *he_dev) 572he_init_cs_block(struct he_dev *he_dev)
573{ 573{
574 unsigned clock, rate, delta; 574 unsigned clock, rate, delta;
@@ -664,7 +664,7 @@ he_init_cs_block(struct he_dev *he_dev)
664 664
665} 665}
666 666
667static int __init 667static int __devinit
668he_init_cs_block_rcm(struct he_dev *he_dev) 668he_init_cs_block_rcm(struct he_dev *he_dev)
669{ 669{
670 unsigned (*rategrid)[16][16]; 670 unsigned (*rategrid)[16][16];
@@ -785,7 +785,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
785 return 0; 785 return 0;
786} 786}
787 787
788static int __init 788static int __devinit
789he_init_group(struct he_dev *he_dev, int group) 789he_init_group(struct he_dev *he_dev, int group)
790{ 790{
791 int i; 791 int i;
@@ -955,7 +955,7 @@ he_init_group(struct he_dev *he_dev, int group)
955 return 0; 955 return 0;
956} 956}
957 957
958static int __init 958static int __devinit
959he_init_irq(struct he_dev *he_dev) 959he_init_irq(struct he_dev *he_dev)
960{ 960{
961 int i; 961 int i;
diff --git a/drivers/base/node.c b/drivers/base/node.c
index e9b0957f15d1..001e6f6b9c1b 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -54,10 +54,12 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
54 "Node %d MemUsed: %8lu kB\n" 54 "Node %d MemUsed: %8lu kB\n"
55 "Node %d Active: %8lu kB\n" 55 "Node %d Active: %8lu kB\n"
56 "Node %d Inactive: %8lu kB\n" 56 "Node %d Inactive: %8lu kB\n"
57#ifdef CONFIG_HIGHMEM
57 "Node %d HighTotal: %8lu kB\n" 58 "Node %d HighTotal: %8lu kB\n"
58 "Node %d HighFree: %8lu kB\n" 59 "Node %d HighFree: %8lu kB\n"
59 "Node %d LowTotal: %8lu kB\n" 60 "Node %d LowTotal: %8lu kB\n"
60 "Node %d LowFree: %8lu kB\n" 61 "Node %d LowFree: %8lu kB\n"
62#endif
61 "Node %d Dirty: %8lu kB\n" 63 "Node %d Dirty: %8lu kB\n"
62 "Node %d Writeback: %8lu kB\n" 64 "Node %d Writeback: %8lu kB\n"
63 "Node %d FilePages: %8lu kB\n" 65 "Node %d FilePages: %8lu kB\n"
@@ -66,16 +68,20 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
66 "Node %d PageTables: %8lu kB\n" 68 "Node %d PageTables: %8lu kB\n"
67 "Node %d NFS_Unstable: %8lu kB\n" 69 "Node %d NFS_Unstable: %8lu kB\n"
68 "Node %d Bounce: %8lu kB\n" 70 "Node %d Bounce: %8lu kB\n"
69 "Node %d Slab: %8lu kB\n", 71 "Node %d Slab: %8lu kB\n"
72 "Node %d SReclaimable: %8lu kB\n"
73 "Node %d SUnreclaim: %8lu kB\n",
70 nid, K(i.totalram), 74 nid, K(i.totalram),
71 nid, K(i.freeram), 75 nid, K(i.freeram),
72 nid, K(i.totalram - i.freeram), 76 nid, K(i.totalram - i.freeram),
73 nid, K(active), 77 nid, K(active),
74 nid, K(inactive), 78 nid, K(inactive),
79#ifdef CONFIG_HIGHMEM
75 nid, K(i.totalhigh), 80 nid, K(i.totalhigh),
76 nid, K(i.freehigh), 81 nid, K(i.freehigh),
77 nid, K(i.totalram - i.totalhigh), 82 nid, K(i.totalram - i.totalhigh),
78 nid, K(i.freeram - i.freehigh), 83 nid, K(i.freeram - i.freehigh),
84#endif
79 nid, K(node_page_state(nid, NR_FILE_DIRTY)), 85 nid, K(node_page_state(nid, NR_FILE_DIRTY)),
80 nid, K(node_page_state(nid, NR_WRITEBACK)), 86 nid, K(node_page_state(nid, NR_WRITEBACK)),
81 nid, K(node_page_state(nid, NR_FILE_PAGES)), 87 nid, K(node_page_state(nid, NR_FILE_PAGES)),
@@ -84,7 +90,10 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
84 nid, K(node_page_state(nid, NR_PAGETABLE)), 90 nid, K(node_page_state(nid, NR_PAGETABLE)),
85 nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), 91 nid, K(node_page_state(nid, NR_UNSTABLE_NFS)),
86 nid, K(node_page_state(nid, NR_BOUNCE)), 92 nid, K(node_page_state(nid, NR_BOUNCE)),
87 nid, K(node_page_state(nid, NR_SLAB))); 93 nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
94 node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
95 nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
96 nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
88 n += hugetlb_report_node_meminfo(nid, buf + n); 97 n += hugetlb_report_node_meminfo(nid, buf + n);
89 return n; 98 return n;
90} 99}
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 6e6a7c7a7eff..ab6429b4a84e 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -209,11 +209,12 @@ static const unsigned char days_in_mo[] =
209 */ 209 */
210static inline unsigned char rtc_is_updating(void) 210static inline unsigned char rtc_is_updating(void)
211{ 211{
212 unsigned long flags;
212 unsigned char uip; 213 unsigned char uip;
213 214
214 spin_lock_irq(&rtc_lock); 215 spin_lock_irqsave(&rtc_lock, flags);
215 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); 216 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
216 spin_unlock_irq(&rtc_lock); 217 spin_unlock_irqrestore(&rtc_lock, flags);
217 return uip; 218 return uip;
218} 219}
219 220
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 71f27e955d87..c7854ea57b52 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -476,13 +476,13 @@ static int auide_dma_lostirq(ide_drive_t *drive)
476 return 0; 476 return 0;
477} 477}
478 478
479static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs) 479static void auide_ddma_tx_callback(int irq, void *param)
480{ 480{
481 _auide_hwif *ahwif = (_auide_hwif*)param; 481 _auide_hwif *ahwif = (_auide_hwif*)param;
482 ahwif->drive->waiting_for_dma = 0; 482 ahwif->drive->waiting_for_dma = 0;
483} 483}
484 484
485static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs) 485static void auide_ddma_rx_callback(int irq, void *param)
486{ 486{
487 _auide_hwif *ahwif = (_auide_hwif*)param; 487 _auide_hwif *ahwif = (_auide_hwif*)param;
488 ahwif->drive->waiting_for_dma = 0; 488 ahwif->drive->waiting_for_dma = 0;
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 88bf2af2a0e7..edd7b83c3464 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
836 break; 836 break;
837 } 837 }
838 838
839 if (index<=0 || index >= vfd->tvnormsize) { 839 if (index < 0 || index >= vfd->tvnormsize) {
840 ret=-EINVAL; 840 ret=-EINVAL;
841 break; 841 break;
842 } 842 }
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index fb606165af3b..61268da13957 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -731,7 +731,7 @@ static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)
731 } 731 }
732} 732}
733 733
734static void au1xmmc_dma_callback(int irq, void *dev_id, struct pt_regs *regs) 734static void au1xmmc_dma_callback(int irq, void *dev_id)
735{ 735{
736 struct au1xmmc_host *host = (struct au1xmmc_host *) dev_id; 736 struct au1xmmc_host *host = (struct au1xmmc_host *) dev_id;
737 737
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 77670741e101..feb42db10ee1 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1323,9 +1323,9 @@ static const struct ethtool_ops sparc_lance_ethtool_ops = {
1323 .get_link = sparc_lance_get_link, 1323 .get_link = sparc_lance_get_link,
1324}; 1324};
1325 1325
1326static int __init sparc_lance_probe_one(struct sbus_dev *sdev, 1326static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1327 struct sbus_dma *ledma, 1327 struct sbus_dma *ledma,
1328 struct sbus_dev *lebuffer) 1328 struct sbus_dev *lebuffer)
1329{ 1329{
1330 static unsigned version_printed; 1330 static unsigned version_printed;
1331 struct net_device *dev; 1331 struct net_device *dev;
@@ -1515,7 +1515,7 @@ fail:
1515} 1515}
1516 1516
1517/* On 4m, find the associated dma for the lance chip */ 1517/* On 4m, find the associated dma for the lance chip */
1518static inline struct sbus_dma *find_ledma(struct sbus_dev *sdev) 1518static struct sbus_dma * __devinit find_ledma(struct sbus_dev *sdev)
1519{ 1519{
1520 struct sbus_dma *p; 1520 struct sbus_dma *p;
1521 1521
@@ -1533,7 +1533,7 @@ static inline struct sbus_dma *find_ledma(struct sbus_dev *sdev)
1533 1533
1534/* Find all the lance cards on the system and initialize them */ 1534/* Find all the lance cards on the system and initialize them */
1535static struct sbus_dev sun4_sdev; 1535static struct sbus_dev sun4_sdev;
1536static int __init sparc_lance_init(void) 1536static int __devinit sparc_lance_init(void)
1537{ 1537{
1538 if ((idprom->id_machtype == (SM_SUN4|SM_4_330)) || 1538 if ((idprom->id_machtype == (SM_SUN4|SM_4_330)) ||
1539 (idprom->id_machtype == (SM_SUN4|SM_4_470))) { 1539 (idprom->id_machtype == (SM_SUN4|SM_4_470))) {
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 372e47f7d596..5f7ba1adb309 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1929,6 +1929,13 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1929 1929
1930 mutex_lock(&state->mutex); 1930 mutex_lock(&state->mutex);
1931 1931
1932#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND
1933 if (uart_console(port)) {
1934 mutex_unlock(&state->mutex);
1935 return 0;
1936 }
1937#endif
1938
1932 if (state->info && state->info->flags & UIF_INITIALIZED) { 1939 if (state->info && state->info->flags & UIF_INITIALIZED) {
1933 const struct uart_ops *ops = port->ops; 1940 const struct uart_ops *ops = port->ops;
1934 1941
@@ -1967,6 +1974,13 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1967 1974
1968 mutex_lock(&state->mutex); 1975 mutex_lock(&state->mutex);
1969 1976
1977#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND
1978 if (uart_console(port)) {
1979 mutex_unlock(&state->mutex);
1980 return 0;
1981 }
1982#endif
1983
1970 uart_change_pm(state, 0); 1984 uart_change_pm(state, 0);
1971 1985
1972 /* 1986 /*
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 4f78f234473d..c151dcf68786 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -397,6 +397,12 @@ static ssize_t store_bl_curve(struct class_device *class_device,
397 u8 tmp_curve[FB_BACKLIGHT_LEVELS]; 397 u8 tmp_curve[FB_BACKLIGHT_LEVELS];
398 unsigned int i; 398 unsigned int i;
399 399
400 /* Some drivers don't use framebuffer_alloc(), but those also
401 * don't have backlights.
402 */
403 if (!fb_info || !fb_info->bl_dev)
404 return -ENODEV;
405
400 if (count != (FB_BACKLIGHT_LEVELS / 8 * 24)) 406 if (count != (FB_BACKLIGHT_LEVELS / 8 * 24))
401 return -EINVAL; 407 return -EINVAL;
402 408
@@ -430,6 +436,12 @@ static ssize_t show_bl_curve(struct class_device *class_device, char *buf)
430 ssize_t len = 0; 436 ssize_t len = 0;
431 unsigned int i; 437 unsigned int i;
432 438
439 /* Some drivers don't use framebuffer_alloc(), but those also
440 * don't have backlights.
441 */
442 if (!fb_info || !fb_info->bl_dev)
443 return -ENODEV;
444
433 mutex_lock(&fb_info->bl_mutex); 445 mutex_lock(&fb_info->bl_mutex);
434 for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8) 446 for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
435 len += snprintf(&buf[len], PAGE_SIZE, 447 len += snprintf(&buf[len], PAGE_SIZE,