Commit 7d857c13 authored by William Stinson's avatar William Stinson Committed by Linus Torvalds

[PATCH] remove check_region from fdc-io.c version 2

  This is version 2 of my proposed patch for fdc-io.c tape driver for
  Linux.  It

  	1) removes three calls to check_region using request_region instead.
  	2) in case of fatal error calls release_region to liberate region
	   resources already allocated (as pointed out by Matthew Wilcox my
	   first patch wasn't doing that)

  Remark regarding allocation of regions in this driver:

  If BROKEN_FLOPPY_DRIVER is defined the driver keeps going even if it
  can't allocate one or more region resources.  The driver does not
  store information concerning which allocations succeeded and which
  failed.  When and if subroutine fdc_release_regions is called it will
  then try to release all regions it normally reserves.  I don't know if
  this could cause any trouble in some (rare) situations?

  I don't have this hardware so only compilation is tested.  This patch
  removes all references to check_region in this driver.

  This is patch number 13 in a series of check_region patches I am doing as
  part of the kernel janitors project.
parent c825e747
......@@ -1209,7 +1209,7 @@ static int fdc_request_regions(void)
TRACE_FUN(ft_t_flow);
if (ft_mach2 || ft_probe_fc10) {
if (check_region(fdc.sra, 8) < 0) {
if (!request_region(fdc.sra, 8, "fdc (ft)")) {
#ifndef BROKEN_FLOPPY_DRIVER
TRACE_EXIT -EBUSY;
#else
......@@ -1217,10 +1217,8 @@ static int fdc_request_regions(void)
"address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra);
#endif
}
request_region(fdc.sra, 8, "fdc (ft)");
} else {
if (check_region(fdc.sra, 6) < 0 ||
check_region(fdc.dir, 1) < 0) {
if (!request_region(fdc.sra, 6, "fdc (ft)")) {
#ifndef BROKEN_FLOPPY_DRIVER
TRACE_EXIT -EBUSY;
#else
......@@ -1228,8 +1226,15 @@ static int fdc_request_regions(void)
"address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra);
#endif
}
request_region(fdc.sra, 6, "fdc (ft)");
request_region(fdc.sra + 7, 1, "fdc (ft)");
if (!request_region(fdc.sra + 7, 1, "fdc (ft)")) {
#ifndef BROKEN_FLOPPY_DRIVER
release_region(fdc.sra, 6);
TRACE_EXIT -EBUSY;
#else
TRACE(ft_t_warn,
"address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra + 7);
#endif
}
}
TRACE_EXIT 0;
}
......
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