Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-…
Browse files Browse the repository at this point in the history
…h-cleanup

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-h-cleanup:
  remove <linux/ata.h> include from <linux/hdreg.h>
  include/linux/hdreg.h: remove unused defines
  isd200: use ATA_* defines instead of *_STAT and *_ERR ones
  include/linux/hdreg.h: cover WIN_* and friends with #ifndef/#endif __KERNEL__
  aoe: WIN_* -> ATA_CMD_*
  isd200: WIN_* -> ATA_CMD_*
  include/linux/hdreg.h: cover struct hd_driveid with #ifndef/#endif __KERNEL__
  xsysace: make it 'struct hd_driveid'-free
  ubd_kern: make it 'struct hd_driveid'-free
  isd200: make it 'struct hd_driveid'-free
  • Loading branch information
torvalds committed Apr 3, 2009
2 parents 8fe74cf + eae6c2b commit ea02259
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 255 deletions.
12 changes: 6 additions & 6 deletions arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/blkdev.h"
#include "linux/ata.h"
#include "linux/hdreg.h"
#include "linux/init.h"
#include "linux/cdrom.h"
Expand Down Expand Up @@ -1308,16 +1309,15 @@ static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct ubd *ubd_dev = bdev->bd_disk->private_data;
struct hd_driveid ubd_id = {
.cyls = 0,
.heads = 128,
.sectors = 32,
};
u16 ubd_id[ATA_ID_WORDS];

switch (cmd) {
struct cdrom_volctrl volume;
case HDIO_GET_IDENTITY:
ubd_id.cyls = ubd_dev->size / (128 * 32 * 512);
memset(&ubd_id, 0, ATA_ID_WORDS * 2);
ubd_id[ATA_ID_CYLS] = ubd_dev->size / (128 * 32 * 512);
ubd_id[ATA_ID_HEADS] = 128;
ubd_id[ATA_ID_SECTORS] = 32;
if(copy_to_user((char __user *) arg, (char *) &ubd_id,
sizeof(ubd_id)))
return -EFAULT;
Expand Down
23 changes: 12 additions & 11 deletions drivers/block/aoe/aoecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Filesystem request handling methods
*/

#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/blkdev.h>
#include <linux/skbuff.h>
Expand Down Expand Up @@ -267,7 +268,7 @@ aoecmd_ata_rw(struct aoedev *d)
writebit = 0;
}

ah->cmdstat = WIN_READ | writebit | extbit;
ah->cmdstat = ATA_CMD_PIO_READ | writebit | extbit;

/* mark all tracking fields and load out */
buf->nframesout += 1;
Expand Down Expand Up @@ -362,10 +363,10 @@ resend(struct aoedev *d, struct aoetgt *t, struct frame *f)
switch (ah->cmdstat) {
default:
break;
case WIN_READ:
case WIN_READ_EXT:
case WIN_WRITE:
case WIN_WRITE_EXT:
case ATA_CMD_PIO_READ:
case ATA_CMD_PIO_READ_EXT:
case ATA_CMD_PIO_WRITE:
case ATA_CMD_PIO_WRITE_EXT:
put_lba(ah, f->lba);

n = f->bcnt;
Expand Down Expand Up @@ -812,8 +813,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
d->htgt = NULL;
n = ahout->scnt << 9;
switch (ahout->cmdstat) {
case WIN_READ:
case WIN_READ_EXT:
case ATA_CMD_PIO_READ:
case ATA_CMD_PIO_READ_EXT:
if (skb->len - sizeof *hin - sizeof *ahin < n) {
printk(KERN_ERR
"aoe: %s. skb->len=%d need=%ld\n",
Expand All @@ -823,8 +824,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
return;
}
memcpy(f->bufaddr, ahin+1, n);
case WIN_WRITE:
case WIN_WRITE_EXT:
case ATA_CMD_PIO_WRITE:
case ATA_CMD_PIO_WRITE_EXT:
ifp = getif(t, skb->dev);
if (ifp) {
ifp->lost = 0;
Expand All @@ -838,7 +839,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
goto xmit;
}
break;
case WIN_IDENTIFY:
case ATA_CMD_ID_ATA:
if (skb->len - sizeof *hin - sizeof *ahin < 512) {
printk(KERN_INFO
"aoe: runt data size in ataid. skb->len=%d\n",
Expand Down Expand Up @@ -914,7 +915,7 @@ aoecmd_ata_id(struct aoedev *d)

/* set up ata header */
ah->scnt = 1;
ah->cmdstat = WIN_IDENTIFY;
ah->cmdstat = ATA_CMD_ID_ATA;
ah->lba3 = 0xa0;

skb->dev = t->ifp->nd;
Expand Down
2 changes: 2 additions & 0 deletions drivers/block/hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <linux/ata.h>
#include <linux/hdreg.h>

#define HD_IRQ 14

#define REALLY_SLOW_IO
#include <asm/system.h>
#include <asm/io.h>
Expand Down
30 changes: 13 additions & 17 deletions drivers/block/xsysace.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/platform_device.h>
#if defined(CONFIG_OF)
Expand Down Expand Up @@ -208,7 +209,7 @@ struct ace_device {
struct gendisk *gd;

/* Inserted CF card parameters */
struct hd_driveid cf_id;
u16 cf_id[ATA_ID_WORDS];
};

static int ace_major;
Expand Down Expand Up @@ -402,21 +403,14 @@ static void ace_dump_regs(struct ace_device *ace)
ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT));
}

void ace_fix_driveid(struct hd_driveid *id)
void ace_fix_driveid(u16 *id)
{
#if defined(__BIG_ENDIAN)
u16 *buf = (void *)id;
int i;

/* All half words have wrong byte order; swap the bytes */
for (i = 0; i < sizeof(struct hd_driveid); i += 2, buf++)
*buf = le16_to_cpu(*buf);

/* Some of the data values are 32bit; swap the half words */
id->lba_capacity = ((id->lba_capacity >> 16) & 0x0000FFFF) |
((id->lba_capacity << 16) & 0xFFFF0000);
id->spg = ((id->spg >> 16) & 0x0000FFFF) |
((id->spg << 16) & 0xFFFF0000);
for (i = 0; i < ATA_ID_WORDS; i++, id++)
*id = le16_to_cpu(*id);
#endif
}

Expand Down Expand Up @@ -614,7 +608,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
break;

case ACE_FSM_STATE_IDENTIFY_COMPLETE:
ace_fix_driveid(&ace->cf_id);
ace_fix_driveid(&ace->cf_id[0]);
ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */

if (ace->data_result) {
Expand All @@ -627,9 +621,10 @@ static void ace_fsm_dostate(struct ace_device *ace)
ace->media_change = 0;

/* Record disk parameters */
set_capacity(ace->gd, ace->cf_id.lba_capacity);
set_capacity(ace->gd,
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
dev_info(ace->dev, "capacity: %i sectors\n",
ace->cf_id.lba_capacity);
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
}

/* We're done, drop to IDLE state and notify waiters */
Expand Down Expand Up @@ -928,12 +923,13 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
struct ace_device *ace = bdev->bd_disk->private_data;
u16 *cf_id = &ace->cf_id[0];

dev_dbg(ace->dev, "ace_getgeo()\n");

geo->heads = ace->cf_id.heads;
geo->sectors = ace->cf_id.sectors;
geo->cylinders = ace->cf_id.cyls;
geo->heads = cf_id[ATA_ID_HEADS];
geo->sectors = cf_id[ATA_ID_SECTORS];
geo->cylinders = cf_id[ATA_ID_CYLS];

return 0;
}
Expand Down
Loading

0 comments on commit ea02259

Please sign in to comment.