lkml.org 
[lkml]   [2008]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 21/21] ide-floppy: remove atomic test_*bit macros
Date
On Friday 11 January 2008, Borislav Petkov wrote:
> This change is temporary and after unification of the IDE subsystem proper
> bit setting and testing macros will be introduced.
>
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> ---
> drivers/ide/ide-floppy.c | 82 +++++++++++++++++++++++++---------------------
> 1 files changed, 45 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
> index 4106eb4..29c1983 100644
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c
> @@ -479,12 +479,12 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
>
> debug_log("Reached %s interrupt handler\n", __FUNCTION__);
>
> - if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
> + if ((1UL << PC_DMA_IN_PROGRESS) & pc->flags) {

How's about introducing new defines i.e.

enum {
IDE_FLOPPY_FLAG_PC_ABORT = (1 << 0),
IDE_FLOPPY_FLAG_PC_DMA_RECOMMENDED = (1 << 1),
IDE_FLOPPY_FLAG_PC_DMA_IN_PROGRESS = (1 << 2),
...
}

instead of open-coding the bit-shifts?

> dma_error = HWIF(drive)->ide_dma_end(drive);
> if (dma_error) {
> printk(KERN_ERR "%s: DMA %s error\n", drive->name,
> write ? "write" : "read");
> - set_bit(PC_DMA_ERROR, &pc->flags);
> + pc->flags |= (1UL << PC_DMA_ERROR);
> } else {
> pc->actually_transferred = pc->request_transfer;
> idefloppy_update_buffers(drive, pc);
> @@ -499,11 +499,11 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
> /* No more interrupts */
> debug_log("Packet command completed, %d bytes transferred\n",
> pc->actually_transferred);
> - clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
> + pc->flags &= ((1UL << PC_DMA_IN_PROGRESS) ^ ~0UL);

Same can be achieved with:

pc->flags &= ~(1 << PC_DMA_IN_PROGRESS);


\
 
 \ /
  Last update: 2008-01-12 21:25    [W:0.135 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site