Skip to content

Commit

Permalink
Merge branches 'upstream', 'raw_report_modifications' and 'apple_magi…
Browse files Browse the repository at this point in the history
…c_mouse' into for-linus

Conflicts:
	drivers/hid/Kconfig
  • Loading branch information
Jiri Kosina committed Feb 25, 2010
2 parents 57ab12e + 71b38bd commit 14ef2b0
Show file tree
Hide file tree
Showing 54 changed files with 922 additions and 328 deletions.
4 changes: 2 additions & 2 deletions Documentation/fault-injection/fault-injection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ o provide a way to configure fault attributes
failslab, fail_page_alloc, and fail_make_request use this way.
Helper functions:

init_fault_attr_entries(entries, attr, name);
void cleanup_fault_attr_entries(entries);
init_fault_attr_dentries(entries, attr, name);
void cleanup_fault_attr_dentries(entries);

- module parameters

Expand Down
19 changes: 19 additions & 0 deletions arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <asm/numa.h>
#include <asm/cacheflush.h>
#include <asm/init.h>
#include <linux/bootmem.h>

static unsigned long dma_reserve __initdata;

Expand Down Expand Up @@ -615,6 +616,21 @@ void __init paging_init(void)
* Memory hotplug specific functions
*/
#ifdef CONFIG_MEMORY_HOTPLUG
/*
* After memory hotplug the variables max_pfn, max_low_pfn and high_memory need
* updating.
*/
static void update_end_of_memory_vars(u64 start, u64 size)
{
unsigned long end_pfn = PFN_UP(start + size);

if (end_pfn > max_pfn) {
max_pfn = end_pfn;
max_low_pfn = end_pfn;
high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
}
}

/*
* Memory is added always to NORMAL zone. This means you will never get
* additional DMA/DMA32 memory.
Expand All @@ -634,6 +650,9 @@ int arch_add_memory(int nid, u64 start, u64 size)
ret = __add_pages(nid, zone, start_pfn, nr_pages);
WARN_ON_ONCE(ret);

/* update max_pfn, max_low_pfn and high_memory */
update_end_of_memory_vars(start, size);

return ret;
}
EXPORT_SYMBOL_GPL(arch_add_memory);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd)
pkt_kobj_remove(pd->kobj_stat);
pkt_kobj_remove(pd->kobj_wqueue);
if (class_pktcdvd)
device_destroy(class_pktcdvd, pd->pkt_dev);
device_unregister(pd->dev);
}


Expand Down
13 changes: 12 additions & 1 deletion drivers/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@ config BT_MRVL_SDIO
Say Y here to compile support for Marvell BT-over-SDIO driver
into the kernel or say M to compile it as module.

endmenu
config BT_ATH3K
tristate "Atheros firmware download driver"
depends on BT_HCIBTUSB
select FW_LOADER
help
Bluetooth firmware download driver.
This driver loads the firmware into the Atheros Bluetooth
chipset.

Say Y here to compile support for "Atheros firmware download driver"
into the kernel or say M to compile it as module (ath3k).

endmenu
1 change: 1 addition & 0 deletions drivers/bluetooth/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o
obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o

obj-$(CONFIG_BT_ATH3K) += ath3k.o
obj-$(CONFIG_BT_MRVL) += btmrvl.o
obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o

Expand Down
187 changes: 187 additions & 0 deletions drivers/bluetooth/ath3k.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/*
* Copyright (c) 2008-2009 Atheros Communications Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/


#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/usb.h>
#include <net/bluetooth/bluetooth.h>

#define VERSION "1.0"


static struct usb_device_id ath3k_table[] = {
/* Atheros AR3011 */
{ USB_DEVICE(0x0CF3, 0x3000) },
{ } /* Terminating entry */
};

MODULE_DEVICE_TABLE(usb, ath3k_table);

#define USB_REQ_DFU_DNLOAD 1
#define BULK_SIZE 4096

struct ath3k_data {
struct usb_device *udev;
u8 *fw_data;
u32 fw_size;
u32 fw_sent;
};

static int ath3k_load_firmware(struct ath3k_data *data,
unsigned char *firmware,
int count)
{
u8 *send_buf;
int err, pipe, len, size, sent = 0;

BT_DBG("ath3k %p udev %p", data, data->udev);

pipe = usb_sndctrlpipe(data->udev, 0);

if ((usb_control_msg(data->udev, pipe,
USB_REQ_DFU_DNLOAD,
USB_TYPE_VENDOR, 0, 0,
firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
BT_ERR("Can't change to loading configuration err");
return -EBUSY;
}
sent += 20;
count -= 20;

send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
if (!send_buf) {
BT_ERR("Can't allocate memory chunk for firmware");
return -ENOMEM;
}

while (count) {
size = min_t(uint, count, BULK_SIZE);
pipe = usb_sndbulkpipe(data->udev, 0x02);
memcpy(send_buf, firmware + sent, size);

err = usb_bulk_msg(data->udev, pipe, send_buf, size,
&len, 3000);

if (err || (len != size)) {
BT_ERR("Error in firmware loading err = %d,"
"len = %d, size = %d", err, len, size);
goto error;
}

sent += size;
count -= size;
}

kfree(send_buf);
return 0;

error:
kfree(send_buf);
return err;
}

static int ath3k_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
const struct firmware *firmware;
struct usb_device *udev = interface_to_usbdev(intf);
struct ath3k_data *data;
int size;

BT_DBG("intf %p id %p", intf, id);

if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;

data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

data->udev = udev;

if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
kfree(data);
return -EIO;
}

size = max_t(uint, firmware->size, 4096);
data->fw_data = kmalloc(size, GFP_KERNEL);
if (!data->fw_data) {
release_firmware(firmware);
kfree(data);
return -ENOMEM;
}

memcpy(data->fw_data, firmware->data, firmware->size);
data->fw_size = firmware->size;
data->fw_sent = 0;
release_firmware(firmware);

usb_set_intfdata(intf, data);
if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) {
usb_set_intfdata(intf, NULL);
return -EIO;
}

return 0;
}

static void ath3k_disconnect(struct usb_interface *intf)
{
struct ath3k_data *data = usb_get_intfdata(intf);

BT_DBG("ath3k_disconnect intf %p", intf);

kfree(data->fw_data);
kfree(data);
}

static struct usb_driver ath3k_driver = {
.name = "ath3k",
.probe = ath3k_probe,
.disconnect = ath3k_disconnect,
.id_table = ath3k_table,
};

static int __init ath3k_init(void)
{
BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION);
return usb_register(&ath3k_driver);
}

static void __exit ath3k_exit(void)
{
usb_deregister(&ath3k_driver);
}

module_init(ath3k_init);
module_exit(ath3k_exit);

MODULE_AUTHOR("Atheros Communications");
MODULE_DESCRIPTION("Atheros AR30xx firmware driver");
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("ath3k-1.fw");
4 changes: 3 additions & 1 deletion drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
unsigned int iobase;
unsigned char reg;

BUG_ON(!info->hdev);
if (!info || !info->hdev)
/* our irq handler is shared */
return IRQ_NONE;

if (!test_bit(CARD_READY, &(info->hw_state)))
return IRQ_HANDLED;
Expand Down
4 changes: 3 additions & 1 deletion drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
int iir;
irqreturn_t r = IRQ_NONE;

BUG_ON(!info->hdev);
if (!info || !info->hdev)
/* our irq handler is shared */
return IRQ_NONE;

iobase = info->p_dev->io.BasePort1;

Expand Down
4 changes: 3 additions & 1 deletion drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
int iir, lsr;
irqreturn_t r = IRQ_NONE;

BUG_ON(!info->hdev);
if (!info || !info->hdev)
/* our irq handler is shared */
return IRQ_NONE;

iobase = info->p_dev->io.BasePort1;

Expand Down
4 changes: 3 additions & 1 deletion drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
int iir, lsr;
irqreturn_t r = IRQ_NONE;

BUG_ON(!info->hdev);
if (!info || !info->hdev)
/* our irq handler is shared */
return IRQ_NONE;

iobase = info->p_dev->io.BasePort1;

Expand Down
30 changes: 19 additions & 11 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
unsigned long p = *ppos;
ssize_t low_count, read, sz;
char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
int err = 0;

read = 0;
if (p < (unsigned long) high_memory) {
Expand Down Expand Up @@ -441,12 +442,16 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
return -ENOMEM;
while (count > 0) {
sz = size_inside_page(p, count);
if (!is_vmalloc_or_module_addr((void *)p)) {
err = -ENXIO;
break;
}
sz = vread(kbuf, (char *)p, sz);
if (!sz)
break;
if (copy_to_user(buf, kbuf, sz)) {
free_page((unsigned long)kbuf);
return -EFAULT;
err = -EFAULT;
break;
}
count -= sz;
buf += sz;
Expand All @@ -455,8 +460,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
}
free_page((unsigned long)kbuf);
}
*ppos = p;
return read;
*ppos = p;
return read ? read : err;
}


Expand Down Expand Up @@ -520,6 +525,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
ssize_t wrote = 0;
ssize_t virtr = 0;
char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
int err = 0;

if (p < (unsigned long) high_memory) {
unsigned long to_write = min_t(unsigned long, count,
Expand All @@ -540,14 +546,16 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
unsigned long sz = size_inside_page(p, count);
unsigned long n;

if (!is_vmalloc_or_module_addr((void *)p)) {
err = -ENXIO;
break;
}
n = copy_from_user(kbuf, buf, sz);
if (n) {
if (wrote + virtr)
break;
free_page((unsigned long)kbuf);
return -EFAULT;
err = -EFAULT;
break;
}
sz = vwrite(kbuf, (char *)p, sz);
vwrite(kbuf, (char *)p, sz);
count -= sz;
buf += sz;
virtr += sz;
Expand All @@ -556,8 +564,8 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
free_page((unsigned long)kbuf);
}

*ppos = p;
return virtr + wrote;
*ppos = p;
return virtr + wrote ? : err;
}
#endif

Expand Down
Loading

0 comments on commit 14ef2b0

Please sign in to comment.