Commit 62523467 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] software hd led support

This adds support for software controlled hard drive LED activity.

This is really nice on such machines as Apple Powerbooks, where there is
no such LED in the first place and the sleep/suspend LED isn't used for
anything when the machine is running.
parent 3e171697
...@@ -136,6 +136,12 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev) ...@@ -136,6 +136,12 @@ struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev)
return ret; return ret;
} }
void blk_queue_activity_fn(request_queue_t *q, activity_fn *fn, void *data)
{
q->activity_fn = fn;
q->activity_data = data;
}
/** /**
* blk_queue_prep_rq - set a prepare_request function for queue * blk_queue_prep_rq - set a prepare_request function for queue
* @q: queue * @q: queue
...@@ -225,6 +231,8 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn) ...@@ -225,6 +231,8 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn)
blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
INIT_LIST_HEAD(&q->plug_list); INIT_LIST_HEAD(&q->plug_list);
blk_queue_activity_fn(q, NULL, NULL);
} }
/** /**
...@@ -1666,6 +1674,9 @@ static inline void add_request(request_queue_t * q, struct request * req, ...@@ -1666,6 +1674,9 @@ static inline void add_request(request_queue_t * q, struct request * req,
{ {
drive_stat_acct(req, req->nr_sectors, 1); drive_stat_acct(req, req->nr_sectors, 1);
if (q->activity_fn)
q->activity_fn(q->activity_data, rq_data_dir(req));
/* /*
* elevator indicated where it wants this request to be * elevator indicated where it wants this request to be
* inserted at elevator_merge time * inserted at elevator_merge time
......
...@@ -243,6 +243,7 @@ typedef void (unplug_fn) (void *q); ...@@ -243,6 +243,7 @@ typedef void (unplug_fn) (void *q);
struct bio_vec; struct bio_vec;
typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
typedef void (activity_fn) (void *data, int rw);
enum blk_queue_state { enum blk_queue_state {
Queue_down, Queue_down,
...@@ -283,6 +284,7 @@ struct request_queue ...@@ -283,6 +284,7 @@ struct request_queue
prep_rq_fn *prep_rq_fn; prep_rq_fn *prep_rq_fn;
unplug_fn *unplug_fn; unplug_fn *unplug_fn;
merge_bvec_fn *merge_bvec_fn; merge_bvec_fn *merge_bvec_fn;
activity_fn *activity_fn;
/* /*
* Auto-unplugging state * Auto-unplugging state
...@@ -300,6 +302,8 @@ struct request_queue ...@@ -300,6 +302,8 @@ struct request_queue
*/ */
void *queuedata; void *queuedata;
void *activity_data;
/* /*
* queue needs bounce pages for pages above this limit * queue needs bounce pages for pages above this limit
*/ */
...@@ -504,6 +508,7 @@ extern void blk_start_queue(request_queue_t *q); ...@@ -504,6 +508,7 @@ extern void blk_start_queue(request_queue_t *q);
extern void blk_stop_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q);
extern void __blk_stop_queue(request_queue_t *q); extern void __blk_stop_queue(request_queue_t *q);
extern void blk_run_queue(request_queue_t *q); extern void blk_run_queue(request_queue_t *q);
extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
static inline request_queue_t *bdev_get_queue(struct block_device *bdev) static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{ {
......
...@@ -1044,6 +1044,8 @@ typedef struct hwif_s { ...@@ -1044,6 +1044,8 @@ typedef struct hwif_s {
void *hwif_data; /* extra hwif data */ void *hwif_data; /* extra hwif data */
unsigned dma; unsigned dma;
void (*led_act)(void *data, int rw);
} ide_hwif_t; } ide_hwif_t;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment