Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87420
b: refs/heads/master
c: 233f112
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Mar 17, 2008
1 parent d01debb commit 87a62b0
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 77 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84841384ec6ec57544b76e564514d3f9eb6c1901
refs/heads/master: 233f112042d0b50170212dbff99c3b34b8773cd3
96 changes: 69 additions & 27 deletions trunk/drivers/ata/libata-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,45 +118,77 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
}

static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj,
static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
u32 event)
{
char event_string[12];
char *envp[] = { event_string, NULL };
struct ata_eh_info *ehi = &ap->link.eh_info;

if (event == 0 || event == 1) {
unsigned long flags;
spin_lock_irqsave(ap->lock, flags);
ata_ehi_clear_desc(ehi);
ata_ehi_push_desc(ehi, "ACPI event");
ata_ehi_hotplugged(ehi);
ata_port_freeze(ap);
spin_unlock_irqrestore(ap->lock, flags);
struct ata_eh_info *ehi;
struct kobject *kobj = NULL;
int wait = 0;
unsigned long flags;

if (!ap)
ap = dev->link->ap;
ehi = &ap->link.eh_info;

spin_lock_irqsave(ap->lock, flags);

switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
ata_ehi_push_desc(ehi, "ACPI event");
ata_ehi_hotplugged(ehi);
ata_port_freeze(ap);
break;

case ACPI_NOTIFY_EJECT_REQUEST:
ata_ehi_push_desc(ehi, "ACPI event");
if (dev)
dev->flags |= ATA_DFLAG_DETACH;
else {
struct ata_link *tlink;
struct ata_device *tdev;

ata_port_for_each_link(tlink, ap)
ata_link_for_each_dev(tdev, tlink)
tdev->flags |= ATA_DFLAG_DETACH;
}

ata_port_schedule_eh(ap);
wait = 1;
break;
}

if (dev) {
if (dev->sdev)
kobj = &dev->sdev->sdev_gendev.kobj;
} else
kobj = &ap->dev->kobj;

if (kobj) {
sprintf(event_string, "BAY_EVENT=%d", event);
kobject_uevent_env(kobj, KOBJ_CHANGE, envp);
}

spin_unlock_irqrestore(ap->lock, flags);

if (wait)
ata_port_wait_eh(ap);
}

static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data)
{
struct ata_device *dev = data;
struct kobject *kobj = NULL;

if (dev->sdev)
kobj = &dev->sdev->sdev_gendev.kobj;

ata_acpi_handle_hotplug(dev->link->ap, kobj, event);
ata_acpi_handle_hotplug(NULL, dev, event);
}

static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data)
{
struct ata_port *ap = data;

ata_acpi_handle_hotplug(ap, &ap->dev->kobj, event);
ata_acpi_handle_hotplug(ap, NULL, event);
}

/**
Expand Down Expand Up @@ -191,20 +223,30 @@ void ata_acpi_associate(struct ata_host *host)
else
ata_acpi_associate_ide_port(ap);

if (ap->acpi_handle)
acpi_install_notify_handler (ap->acpi_handle,
ACPI_SYSTEM_NOTIFY,
ata_acpi_ap_notify,
ap);
if (ap->acpi_handle) {
acpi_install_notify_handler(ap->acpi_handle,
ACPI_SYSTEM_NOTIFY,
ata_acpi_ap_notify, ap);
#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
/* we might be on a docking station */
register_hotplug_dock_device(ap->acpi_handle,
ata_acpi_ap_notify, ap);
#endif
}

for (j = 0; j < ata_link_max_devices(&ap->link); j++) {
struct ata_device *dev = &ap->link.device[j];

if (dev->acpi_handle)
acpi_install_notify_handler (dev->acpi_handle,
ACPI_SYSTEM_NOTIFY,
ata_acpi_dev_notify,
dev);
if (dev->acpi_handle) {
acpi_install_notify_handler(dev->acpi_handle,
ACPI_SYSTEM_NOTIFY,
ata_acpi_dev_notify, dev);
#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
/* we might be on a docking station */
register_hotplug_dock_device(dev->acpi_handle,
ata_acpi_dev_notify, dev);
#endif
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ static int virtblk_probe(struct virtio_device *vdev)
vblk->disk->first_minor = index_to_minor(index);
vblk->disk->private_data = vblk;
vblk->disk->fops = &virtblk_fops;
vblk->disk->driverfs_dev = &vdev->dev;
index++;

/* If barriers are supported, tell block layer that queue is ordered */
Expand Down
22 changes: 3 additions & 19 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,8 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
if (received < budget) {
netif_rx_complete(vi->dev, napi);
if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
&& napi_schedule_prep(napi)) {
vi->rvq->vq_ops->disable_cb(vi->rvq);
__netif_rx_schedule(vi->dev, napi);
&& netif_rx_reschedule(vi->dev, napi))
goto again;
}
}

return received;
Expand Down Expand Up @@ -281,11 +278,10 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
pr_debug("%s: virtio not prepared to send\n", dev->name);
netif_stop_queue(dev);

/* Activate callback for using skbs: if this returns false it
/* Activate callback for using skbs: if this fails it
* means some were used in the meantime. */
if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
printk("Unlikely: restart svq race\n");
vi->svq->vq_ops->disable_cb(vi->svq);
printk("Unlikely: restart svq failed\n");
netif_start_queue(dev);
goto again;
}
Expand All @@ -298,15 +294,6 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}

#ifdef CONFIG_NET_POLL_CONTROLLER
static void virtnet_netpoll(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);

napi_schedule(&vi->napi);
}
#endif

static int virtnet_open(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
Expand Down Expand Up @@ -349,9 +336,6 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->stop = virtnet_close;
dev->hard_start_xmit = start_xmit;
dev->features = NETIF_F_HIGHDMA;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = virtnet_netpoll;
#endif
SET_NETDEV_DEV(dev, &vdev->dev);

/* Do we support "hardware" checksums? */
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/virtio/virtio_balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev)
wake_up(&vb->config_change);
}

static inline s64 towards_target(struct virtio_balloon *vb)
static inline int towards_target(struct virtio_balloon *vb)
{
u32 v;
__virtio_config_val(vb->vdev,
Expand All @@ -176,7 +176,7 @@ static int balloon(void *_vballoon)

set_freezable();
while (!kthread_should_stop()) {
s64 diff;
int diff;

try_to_freeze();
wait_event_interruptible(vb->config_change,
Expand Down
15 changes: 6 additions & 9 deletions trunk/drivers/virtio/virtio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
struct virtio_pci_device *vp_dev = opaque;
struct virtio_pci_vq_info *info;
irqreturn_t ret = IRQ_NONE;
unsigned long flags;
u8 isr;

/* reading the ISR has the effect of also clearing it so it's very
Expand All @@ -198,12 +197,12 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
drv->config_changed(&vp_dev->vdev);
}

spin_lock_irqsave(&vp_dev->lock, flags);
spin_lock(&vp_dev->lock);
list_for_each_entry(info, &vp_dev->virtqueues, node) {
if (vring_interrupt(irq, info->vq) == IRQ_HANDLED)
ret = IRQ_HANDLED;
}
spin_unlock_irqrestore(&vp_dev->lock, flags);
spin_unlock(&vp_dev->lock);

return ret;
}
Expand All @@ -215,7 +214,6 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
struct virtio_pci_vq_info *info;
struct virtqueue *vq;
unsigned long flags;
u16 num;
int err;

Expand Down Expand Up @@ -257,9 +255,9 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
vq->priv = info;
info->vq = vq;

spin_lock_irqsave(&vp_dev->lock, flags);
spin_lock(&vp_dev->lock);
list_add(&info->node, &vp_dev->virtqueues);
spin_unlock_irqrestore(&vp_dev->lock, flags);
spin_unlock(&vp_dev->lock);

return vq;

Expand All @@ -276,11 +274,10 @@ static void vp_del_vq(struct virtqueue *vq)
{
struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
struct virtio_pci_vq_info *info = vq->priv;
unsigned long flags;

spin_lock_irqsave(&vp_dev->lock, flags);
spin_lock(&vp_dev->lock);
list_del(&info->node);
spin_unlock_irqrestore(&vp_dev->lock, flags);
spin_unlock(&vp_dev->lock);

vring_del_virtqueue(vq);

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static bool vring_enable_cb(struct virtqueue *_vq)
vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
mb();
if (unlikely(more_used(vq))) {
vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
END_USE(vq);
return false;
}
Expand Down
18 changes: 3 additions & 15 deletions trunk/fs/hfs/brec.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)
static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
{
struct hfs_btree *tree;
struct hfs_bnode *node, *new_node, *next_node;
struct hfs_bnode *node, *new_node;
struct hfs_bnode_desc node_desc;
int num_recs, new_rec_off, new_off, old_rec_off;
int data_start, data_end, size;
Expand All @@ -248,17 +248,6 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
new_node->type = node->type;
new_node->height = node->height;

if (node->next)
next_node = hfs_bnode_find(tree, node->next);
else
next_node = NULL;

if (IS_ERR(next_node)) {
hfs_bnode_put(node);
hfs_bnode_put(new_node);
return next_node;
}

size = tree->node_size / 2 - node->num_recs * 2 - 14;
old_rec_off = tree->node_size - 4;
num_recs = 1;
Expand All @@ -272,8 +261,6 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
/* panic? */
hfs_bnode_put(node);
hfs_bnode_put(new_node);
if (next_node)
hfs_bnode_put(next_node);
return ERR_PTR(-ENOSPC);
}

Expand Down Expand Up @@ -328,7 +315,8 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc));

/* update next bnode header */
if (next_node) {
if (new_node->next) {
struct hfs_bnode *next_node = hfs_bnode_find(tree, new_node->next);
next_node->prev = new_node->this;
hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc));
node_desc.prev = cpu_to_be32(next_node->prev);
Expand Down
5 changes: 2 additions & 3 deletions trunk/include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ struct virtqueue
* vq: the struct virtqueue we're talking about.
* @enable_cb: restart callbacks after disable_cb.
* vq: the struct virtqueue we're talking about.
* This re-enables callbacks; it returns "false" if there are pending
* buffers in the queue, to detect a possible race between the driver
* checking for more work, and enabling callbacks.
* This returns "false" (and doesn't re-enable) if there are pending
* buffers in the queue, to avoid a race.
*
* Locking rules are straightforward: the driver is responsible for
* locking. No two operations may be invoked simultaneously.
Expand Down

0 comments on commit 87a62b0

Please sign in to comment.