@@ -50,15 +50,18 @@ char * path = 0;
5050int dio = 0 ;
5151int port = 0 ;
5252int localhostonly = 0 ;
53- long timeout = 1000 ;
5453
5554extern struct resource iomem_resource ;
5655
5756module_param (path , charp , S_IRUGO );
5857module_param (dio , int , S_IRUGO );
5958module_param (format , charp , S_IRUGO );
6059module_param (localhostonly , int , S_IRUGO );
60+
61+ #ifdef LIME_SUPPORTS_TIMING
62+ long timeout = 1000 ;
6163module_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