Skip to content

Commit 08046a1

Browse files
committed
Disabled timeout for kernel versions < 2.6.16.
1 parent 7b92b93 commit 08046a1

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/lime.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
#define DBG(fmt, args...) do {} while(0)
5656
#endif
5757

58+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
59+
#define LIME_SUPPORTS_TIMING
60+
#endif
61+
5862
//structures
5963

6064
typedef struct {

src/main.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,18 @@ char * path = 0;
5050
int dio = 0;
5151
int port = 0;
5252
int localhostonly = 0;
53-
long timeout = 1000;
5453

5554
extern struct resource iomem_resource;
5655

5756
module_param(path, charp, S_IRUGO);
5857
module_param(dio, int, S_IRUGO);
5958
module_param(format, charp, S_IRUGO);
6059
module_param(localhostonly, int, S_IRUGO);
60+
61+
#ifdef LIME_SUPPORTS_TIMING
62+
long timeout = 1000;
6163
module_param(timeout, long, S_IRUGO);
64+
#endif
6265

6366
#define RETRY_IF_INTURRUPTED(f) ({ \
6467
ssize_t err; \
@@ -84,6 +87,10 @@ int init_module (void)
8487
DBG(" FORMAT: %s", format);
8588
DBG(" LOCALHOSTONLY: %u", localhostonly);
8689

90+
#ifdef LIME_SUPPORTS_TIMING
91+
DBG(" TIMEOUT: %lu", timeout);
92+
#endif
93+
8794
memset(zero_page, 0, sizeof(zero_page));
8895

8996
if (!strcmp(format, "raw")) mode = LIME_MODE_RAW;
@@ -188,12 +195,17 @@ static void write_range(struct resource * res) {
188195
void * v;
189196

190197
ssize_t s;
198+
199+
#ifdef LIME_SUPPORTS_TIMING
191200
ktime_t start,end;
201+
#endif
192202

193203
DBG("Writing range %llx - %llx.", res->start, res->end);
194204

195205
for (i = res->start; i <= res->end; i += is) {
206+
#ifdef LIME_SUPPORTS_TIMING
196207
start = ktime_get_real();
208+
#endif
197209

198210
p = pfn_to_page((i) >> PAGE_SHIFT);
199211

@@ -218,13 +230,16 @@ static void write_range(struct resource * res) {
218230
}
219231
}
220232

233+
#ifdef LIME_SUPPORTS_TIMING
221234
end = ktime_get_real();
222235

223236
if (timeout > 0 && ktime_to_ms(ktime_sub(end, start)) > timeout) {
224237
DBG("Reading is too slow. Skipping Range...");
225238
write_padding(res->end - i + 1 - is);
226239
break;
227240
}
241+
#endif
242+
228243
}
229244
}
230245

0 commit comments

Comments
 (0)