/* * Request dispatcher. */ static int sd_do_request(struct sd_host *host, struct request *req) { int nr_sectors = 0; int error; error = sd_check_request(host, req); if (error) { nr_sectors = error; goto out; } //I added the 2 different read/write functions, so we just need one if-else and should perform much better ^^ switch (rq_data_dir(req)) { case WRITE: if(sd_card_is_sdhc()==0) nr_sectors = sd_write_request(host, req); else nr_sectors = sdhc_write_request(host, req); break; case READ: if(sd_card_is_sdhc()==0) nr_sectors = sd_read_request(host, req); else nr_sectors = sdhc_read_request(host, req); break; } out: return nr_sectors; }
/* * Request dispatcher. */ static int sd_do_request(struct sd_host *host, struct request *req) { int nr_sectors = 0; int error; error = sd_check_request(host, req); if (error) { nr_sectors = error; goto out; } switch (rq_data_dir(req)) { case WRITE: nr_sectors = sd_write_request(host, req); break; case READ: nr_sectors = sd_read_request(host, req); break; } out: return nr_sectors; }