From f6d4f1f8da51584bbfe90c22681f933cbf6d3f4c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 5 Nov 2007 10:45:27 +1000 Subject: [PATCH] --- yaml --- r: 73113 b: refs/heads/master c: 7fc86860cf73e060ab8ed9763010dfe5b5389b1c h: refs/heads/master i: 73111: 61df8c64c87f7a09d9221759141d11d08bac165e v: v3 --- [refs] | 2 +- trunk/drivers/ata/libata-scsi.c | 8 +- trunk/drivers/char/drm/radeon_cp.c | 5 +- trunk/drivers/char/drm/radeon_drv.h | 1 + trunk/drivers/scsi/scsi_lib.c | 136 ---------------------------- trunk/drivers/scsi/scsi_scan.c | 3 - trunk/drivers/scsi/scsi_sysfs.c | 47 ---------- trunk/include/scsi/scsi_device.h | 25 ----- 8 files changed, 8 insertions(+), 219 deletions(-) diff --git a/[refs] b/[refs] index 206a331e9a85..440ee8088777 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: aa641935343e05795f7f7289e7b242138b612ffe +refs/heads/master: 7fc86860cf73e060ab8ed9763010dfe5b5389b1c diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index 94144ed50a6b..245057df69d6 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -841,9 +841,6 @@ static void ata_scsi_dev_config(struct scsi_device *sdev, blk_queue_max_hw_segments(q, q->max_hw_segments - 1); } - if (dev->flags & ATA_DFLAG_AN) - set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); - if (dev->flags & ATA_DFLAG_NCQ) { int depth; @@ -3299,9 +3296,10 @@ static void ata_scsi_handle_link_detach(struct ata_link *link) */ void ata_scsi_media_change_notify(struct ata_device *dev) { +#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED if (dev->sdev) - sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE, - GFP_ATOMIC); + scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE); +#endif } /** diff --git a/trunk/drivers/char/drm/radeon_cp.c b/trunk/drivers/char/drm/radeon_cp.c index 335423c5c186..24fca8ec1379 100644 --- a/trunk/drivers/char/drm/radeon_cp.c +++ b/trunk/drivers/char/drm/radeon_cp.c @@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) dev_priv->gart_info.bus_addr = dev_priv->pcigart_offset + dev_priv->fb_location; dev_priv->gart_info.mapping.offset = - dev_priv->gart_info.bus_addr; + dev_priv->pcigart_offset + dev_priv->fb_aper_offset; dev_priv->gart_info.mapping.size = dev_priv->gart_info.table_size; @@ -2275,7 +2275,8 @@ int radeon_driver_firstopen(struct drm_device *dev) if (ret != 0) return ret; - ret = drm_addmap(dev, drm_get_resource_start(dev, 0), + dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0); + ret = drm_addmap(dev, dev_priv->fb_aper_offset, drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, &map); if (ret != 0) diff --git a/trunk/drivers/char/drm/radeon_drv.h b/trunk/drivers/char/drm/radeon_drv.h index e4077bc212b3..bfbb60a9298c 100644 --- a/trunk/drivers/char/drm/radeon_drv.h +++ b/trunk/drivers/char/drm/radeon_drv.h @@ -293,6 +293,7 @@ typedef struct drm_radeon_private { /* starting from here on, data is preserved accross an open */ uint32_t flags; /* see radeon_chip_flags */ + unsigned long fb_aper_offset; } drm_radeon_private_t; typedef struct drm_radeon_buf_priv { diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index 0e81e4cf8876..88de771d3569 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -2114,142 +2114,6 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) } EXPORT_SYMBOL(scsi_device_set_state); -/** - * sdev_evt_emit - emit a single SCSI device uevent - * @sdev: associated SCSI device - * @evt: event to emit - * - * Send a single uevent (scsi_event) to the associated scsi_device. - */ -static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt) -{ - int idx = 0; - char *envp[3]; - - switch (evt->evt_type) { - case SDEV_EVT_MEDIA_CHANGE: - envp[idx++] = "SDEV_MEDIA_CHANGE=1"; - break; - - default: - /* do nothing */ - break; - } - - envp[idx++] = NULL; - - kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp); -} - -/** - * sdev_evt_thread - send a uevent for each scsi event - * @work: work struct for scsi_device - * - * Dispatch queued events to their associated scsi_device kobjects - * as uevents. - */ -void scsi_evt_thread(struct work_struct *work) -{ - struct scsi_device *sdev; - LIST_HEAD(event_list); - - sdev = container_of(work, struct scsi_device, event_work); - - while (1) { - struct scsi_event *evt; - struct list_head *this, *tmp; - unsigned long flags; - - spin_lock_irqsave(&sdev->list_lock, flags); - list_splice_init(&sdev->event_list, &event_list); - spin_unlock_irqrestore(&sdev->list_lock, flags); - - if (list_empty(&event_list)) - break; - - list_for_each_safe(this, tmp, &event_list) { - evt = list_entry(this, struct scsi_event, node); - list_del(&evt->node); - scsi_evt_emit(sdev, evt); - kfree(evt); - } - } -} - -/** - * sdev_evt_send - send asserted event to uevent thread - * @sdev: scsi_device event occurred on - * @evt: event to send - * - * Assert scsi device event asynchronously. - */ -void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt) -{ - unsigned long flags; - - if (!test_bit(evt->evt_type, sdev->supported_events)) { - kfree(evt); - return; - } - - spin_lock_irqsave(&sdev->list_lock, flags); - list_add_tail(&evt->node, &sdev->event_list); - schedule_work(&sdev->event_work); - spin_unlock_irqrestore(&sdev->list_lock, flags); -} -EXPORT_SYMBOL_GPL(sdev_evt_send); - -/** - * sdev_evt_alloc - allocate a new scsi event - * @evt_type: type of event to allocate - * @gfpflags: GFP flags for allocation - * - * Allocates and returns a new scsi_event. - */ -struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, - gfp_t gfpflags) -{ - struct scsi_event *evt = kzalloc(sizeof(struct scsi_event), gfpflags); - if (!evt) - return NULL; - - evt->evt_type = evt_type; - INIT_LIST_HEAD(&evt->node); - - /* evt_type-specific initialization, if any */ - switch (evt_type) { - case SDEV_EVT_MEDIA_CHANGE: - default: - /* do nothing */ - break; - } - - return evt; -} -EXPORT_SYMBOL_GPL(sdev_evt_alloc); - -/** - * sdev_evt_send_simple - send asserted event to uevent thread - * @sdev: scsi_device event occurred on - * @evt_type: type of event to send - * @gfpflags: GFP flags for allocation - * - * Assert scsi device event asynchronously, given an event type. - */ -void sdev_evt_send_simple(struct scsi_device *sdev, - enum scsi_device_event evt_type, gfp_t gfpflags) -{ - struct scsi_event *evt = sdev_evt_alloc(evt_type, gfpflags); - if (!evt) { - sdev_printk(KERN_ERR, sdev, "event %d eaten due to OOM\n", - evt_type); - return; - } - - sdev_evt_send(sdev, evt); -} -EXPORT_SYMBOL_GPL(sdev_evt_send_simple); - /** * scsi_device_quiesce - Block user issued commands. * @sdev: scsi device to quiesce. diff --git a/trunk/drivers/scsi/scsi_scan.c b/trunk/drivers/scsi/scsi_scan.c index 40ea71cd2ca6..b53c5f67e372 100644 --- a/trunk/drivers/scsi/scsi_scan.c +++ b/trunk/drivers/scsi/scsi_scan.c @@ -236,7 +236,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, struct scsi_device *sdev; int display_failure_msg = 1, ret; struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - extern void scsi_evt_thread(struct work_struct *work); sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, GFP_ATOMIC); @@ -255,9 +254,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, INIT_LIST_HEAD(&sdev->same_target_siblings); INIT_LIST_HEAD(&sdev->cmd_list); INIT_LIST_HEAD(&sdev->starved_entry); - INIT_LIST_HEAD(&sdev->event_list); spin_lock_init(&sdev->list_lock); - INIT_WORK(&sdev->event_work, scsi_evt_thread); sdev->sdev_gendev.parent = get_device(&starget->dev); sdev->sdev_target = starget; diff --git a/trunk/drivers/scsi/scsi_sysfs.c b/trunk/drivers/scsi/scsi_sysfs.c index f374fdcb6815..d531ceeb0d8c 100644 --- a/trunk/drivers/scsi/scsi_sysfs.c +++ b/trunk/drivers/scsi/scsi_sysfs.c @@ -268,7 +268,6 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) struct scsi_device *sdev; struct device *parent; struct scsi_target *starget; - struct list_head *this, *tmp; unsigned long flags; sdev = container_of(work, struct scsi_device, ew.work); @@ -283,16 +282,6 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) list_del(&sdev->starved_entry); spin_unlock_irqrestore(sdev->host->host_lock, flags); - cancel_work_sync(&sdev->event_work); - - list_for_each_safe(this, tmp, &sdev->event_list) { - struct scsi_event *evt; - - evt = list_entry(this, struct scsi_event, node); - list_del(&evt->node); - kfree(evt); - } - if (sdev->request_queue) { sdev->request_queue->queuedata = NULL; /* user context needed to free queue */ @@ -625,41 +614,6 @@ sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) } static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); -#define DECLARE_EVT_SHOW(name, Cap_name) \ -static ssize_t \ -sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ - char *buf) \ -{ \ - struct scsi_device *sdev = to_scsi_device(dev); \ - int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ - return snprintf(buf, 20, "%d\n", val); \ -} - -#define DECLARE_EVT_STORE(name, Cap_name) \ -static ssize_t \ -sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ - const char *buf, size_t count) \ -{ \ - struct scsi_device *sdev = to_scsi_device(dev); \ - int val = simple_strtoul(buf, NULL, 0); \ - if (val == 0) \ - clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ - else if (val == 1) \ - set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ - else \ - return -EINVAL; \ - return count; \ -} - -#define DECLARE_EVT(name, Cap_name) \ - DECLARE_EVT_SHOW(name, Cap_name) \ - DECLARE_EVT_STORE(name, Cap_name) \ - static DEVICE_ATTR(evt_##name, S_IRUGO, sdev_show_evt_##name, \ - sdev_store_evt_##name); -#define REF_EVT(name) &dev_attr_evt_##name.attr - -DECLARE_EVT(media_change, MEDIA_CHANGE) - /* Default template for device attributes. May NOT be modified */ static struct attribute *scsi_sdev_attrs[] = { &dev_attr_device_blocked.attr, @@ -677,7 +631,6 @@ static struct attribute *scsi_sdev_attrs[] = { &dev_attr_iodone_cnt.attr, &dev_attr_ioerr_cnt.attr, &dev_attr_modalias.attr, - REF_EVT(media_change), NULL }; diff --git a/trunk/include/scsi/scsi_device.h b/trunk/include/scsi/scsi_device.h index 66e9058357e0..d5057bc338ff 100644 --- a/trunk/include/scsi/scsi_device.h +++ b/trunk/include/scsi/scsi_device.h @@ -46,22 +46,6 @@ enum scsi_device_state { * to the scsi lld. */ }; -enum scsi_device_event { - SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */ - - SDEV_EVT_LAST = SDEV_EVT_MEDIA_CHANGE, - SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1 -}; - -struct scsi_event { - enum scsi_device_event evt_type; - struct list_head node; - - /* put union of data structures, for non-simple event types, - * here - */ -}; - struct scsi_device { struct Scsi_Host *host; struct request_queue *request_queue; @@ -143,10 +127,6 @@ struct scsi_device { unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ - DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ - struct list_head event_list; /* asserted events */ - struct work_struct event_work; - unsigned int device_blocked; /* Device returned QUEUE_FULL. */ unsigned int max_device_blocked; /* what device_blocked counts down from */ @@ -295,11 +275,6 @@ extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries); extern int scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state); -extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, - gfp_t gfpflags); -extern void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt); -extern void sdev_evt_send_simple(struct scsi_device *sdev, - enum scsi_device_event evt_type, gfp_t gfpflags); extern int scsi_device_quiesce(struct scsi_device *sdev); extern void scsi_device_resume(struct scsi_device *sdev); extern void scsi_target_quiesce(struct scsi_target *);