]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aic7xxx/aicasm/aicasm.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[linux-2.6-omap-h63xx.git] / drivers / scsi / aic7xxx / aicasm / aicasm.c
index f936b691232f90d4d020998d8a3420508b36cc85..e4a778720301d4f5bcae7a5ed50b2785ad8ccf3b 100644 (file)
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#22 $
+ * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#23 $
  *
  * $FreeBSD$
  */
@@ -362,7 +362,7 @@ output_code()
 " *\n"
 "%s */\n", versions);
 
-       fprintf(ofile, "static uint8_t seqprog[] = {\n");
+       fprintf(ofile, "static const uint8_t seqprog[] = {\n");
        for (cur_instr = STAILQ_FIRST(&seq_program);
             cur_instr != NULL;
             cur_instr = STAILQ_NEXT(cur_instr, links)) {
@@ -415,7 +415,7 @@ output_code()
        }
 
        fprintf(ofile,
-"static struct patch {\n"
+"static const struct patch {\n"
 "      %spatch_func_t          *patch_func;\n"
 "      uint32_t                 begin          :10,\n"
 "                               skip_instr     :10,\n"
@@ -435,7 +435,7 @@ output_code()
        fprintf(ofile, "\n};\n\n");
 
        fprintf(ofile,
-"static struct cs {\n"
+"static const struct cs {\n"
 "      uint16_t        begin;\n"
 "      uint16_t        end;\n"
 "} critical_sections[] = {\n");
@@ -609,10 +609,10 @@ output_listing(char *ifilename)
 
                while (line < cur_instr->srcline) {
                        fgets(buf, sizeof(buf), ifile);
-                               fprintf(listfile, "\t\t%s", buf);
+                               fprintf(listfile, "             \t%s", buf);
                                line++;
                }
-               fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr,
+               fprintf(listfile, "%04x %02x%02x%02x%02x", instrptr,
 #ifdef __LITTLE_ENDIAN
                        cur_instr->format.bytes[0],
                        cur_instr->format.bytes[1],
@@ -624,14 +624,23 @@ output_listing(char *ifilename)
                        cur_instr->format.bytes[1],
                        cur_instr->format.bytes[0]);
 #endif
-               fgets(buf, sizeof(buf), ifile);
-               fprintf(listfile, "\t%s", buf);
-               line++;
+               /*
+                * Macro expansions can cause several instructions
+                * to be output for a single source line.  Only
+                * advance the line once in these cases.
+                */
+               if (line == cur_instr->srcline) {
+                       fgets(buf, sizeof(buf), ifile);
+                       fprintf(listfile, "\t%s", buf);
+                       line++;
+               } else {
+                       fprintf(listfile, "\n");
+               }
                instrptr++;
        }
        /* Dump the remainder of the file */
        while(fgets(buf, sizeof(buf), ifile) != NULL)
-               fprintf(listfile, "\t\t%s", buf);
+               fprintf(listfile, "             %s", buf);
 
        fclose(ifile);
 }