lkml.org 
[lkml]   [2008]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] firewire: reread config ROM when device reset the bus
Kristian Høgsberg wrote:
> I would just add a
>
> case REREAD_BIB_CHANGED:
> break;
>
> to the switch to make that clear,

Yes, that's nicer.

> but otherwise
>
> Signed-off-by: Kristian Høgsberg <krh@redhat.com>

Thanks.

...
>> --- linux.orig/drivers/firewire/fw-cdev.c
>> +++ linux/drivers/firewire/fw-cdev.c
>> @@ -269,20 +270,25 @@ static int ioctl_get_info(struct client
>> {
>> struct fw_cdev_get_info *get_info = buffer;
>> struct fw_cdev_event_bus_reset bus_reset;
>> + struct fw_device *device = client->device;
>> + unsigned long ret = 0;
>>
>> client->version = get_info->version;
>> get_info->version = FW_CDEV_VERSION;
>>
>> + down(&device->device.sem);
>> if (get_info->rom != 0) {
>> void __user *uptr = u64_to_uptr(get_info->rom);
>> size_t want = get_info->rom_length;
>> - size_t have = client->device->config_rom_length * 4;
>> + size_t have;
>>
>> - if (copy_to_user(uptr, client->device->config_rom,
>> - min(want, have)))
>> - return -EFAULT;
>> + have = device->config_rom_length * 4;
>> + ret = copy_to_user(uptr, device->config_rom, min(want, have));
>> }
>> - get_info->rom_length = client->device->config_rom_length * 4;
>> + get_info->rom_length = device->config_rom_length * 4;
>> + up(&device->device.sem);
>> + if (ret != 0)
>> + return -EFAULT;
>>
>> client->bus_reset_closure = get_info->bus_reset_closure;
>> if (get_info->bus_reset != 0) {

Maybe I should rather use fw-device.c::idr_rwsem instead of device.sem,
to have better control over who takes the mutex when. Could also be a
new dedicated mutex but we don't want to end up with too many of them...
Do you have an opinion?
--
Stefan Richter
-=====-==--- --== ---==
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-03-03 17:55    [W:0.085 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site