title: How to address multiple definition compiler error
body: <p>I am getting the following error messages, and I checked the file but can not figure out why or how to address the errors. Please help. </p>
  
  <pre><code>arch/arm/mach-msm/jtag-mm.o: In function `dbg_init_arch_data':
  /home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag-mm.c:279: multiple definition of `msm_jtag_save_cntr'
  arch/arm/mach-msm/jtag.o:/home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag.c:1085: first defined here
  arch/arm/mach-msm/jtag-mm.o: In function `etm_init_arch_data':
  /home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag-mm.c:568: multiple definition of `msm_jtag_save_state'
  arch/arm/mach-msm/jtag.o:/home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag.c:1038: first defined here
  arch/arm/mach-msm/jtag-mm.o: In function `msm_jtag_restore_state':
  /home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag-mm.c:585: multiple definition of `msm_jtag_restore_state'
  arch/arm/mach-msm/jtag.o:/home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag.c:1073: first defined here
  arch/arm/mach-msm/jtag-mm.o: In function `dbg_init_arch_data':
  /home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag-mm.c:279: multiple definition of `msm_jtag_restore_cntr'
  arch/arm/mach-msm/jtag.o:/home/sansari/WORKING_DIRECTORY/arch/arm/mach-msm/jtag.c:1085: first defined here
  make[1]: *** [arch/arm/mach-msm/built-in.o] Error 1
  </code></pre>
  
  <p>I put a copy of jtag-mm.c at <a href="http://pastebin.com/5rtxQdD8" rel="nofollow">this link</a></p>
  
  <p>Thanks. Here is <a href="http://pastebin.com/aU2Vd3UT" rel="nofollow">jtag.c</a></p>
  
  <p>After commenting out the jtag.h, and recompiling I get the following error message: </p>
  
  <pre><code>arch/arm/mach-msm/jtag-mm.c:790:2: error: implicit declaration of function 'msm_jtag_fuse_apps_access_disabled' [-Werror=implicit-function-declaration]
  cc1: some warnings being treated as errors
  make[1]: *** [arch/arm/mach-msm/jtag-mm.o] Error 1
  make: *** [arch/arm/mach-msm] Error 2
  </code></pre>
  
  <p>@Peter - Thanks. I get what you are saying. Ok. let me try it. Never mind about the grep comment:-) I see it is not possible.</p>
  
  <p>Update: Thanks. I can see what the issue is now. Now that I have posted the jtag.h, and jtag-mm.c, and jtag.c, you can perhaps validate what I think is the issue. As Peter mentioned, the variables are declared twice. Once by jtag.c and again by jtag-mm.c. For instance, I see the lines: </p>
  
  <pre><code>uint32_t msm_jtag_save_cntr[NR_CPUS];
  uint32_t msm_jtag_restore_cntr[NR_CPUS];
  </code></pre>
  
  <p>in both files. But I tried to comment them out in one file, and I get an error since the variable is used in the same file in a function. What is the right way of handling this then? Can I declare it in the header file once, and just remove it from both source files? Or should I leave the deceleration in one source file, and include it in the other? </p>
  
  <p><a href="http://pastebin.com/dKUTHP2J" rel="nofollow">Here</a> is a copy of jtag.h
  Thanks</p>