Smoker's cough is a form of chronic bronchitis1 caused by tobacco smoke. It is a response to pollutants in the lungs and generally should not be inhibited, except by removing the original irritant. That is to say, stop smoking.
Smoker's cough is the result of two different responses to the smoke. First, the smoke causes the cells lining the respiratory tract to produce more mucus, and the mucus produced is more viscous. Second, the smoke paralyzes the cilia that line the airways. These cilia are supposed to beat constantly, slowly moving mucus in the airways out to the throat, where it can be swallowed.
With too much mucus in the respiratory system and with the usual transportation system paralyzed, the body falls back to the emergency backup plan: coughing. Smoker's cough is usually productive, bringing up a lot of phlegm. This cough is good and necessary. Less coughing would mean more congestion, and less oxygen exchange taking place in the lungs. As it is, the aveoli are never completely cleared, and shortness of breath and decreased physical activity result. The trapped mucus may also become infected, resulting in further lung damage.
The increased mucus production should stop as soon as you stop smoking, but some of the damage to the cilia is permanent. The exact amount of permanent damage depends on many factors, but given a chance the bronchial tubes will be able to repair some of the cilia. As the cilia start working, you may experience increased coughing. This is because all of the muck that was trapped in your lungs is finally getting a chance to escape. This is another good cough, and should not be suppressed.
Second-hand smoke can also cause chronic bronchitis, although this would not normally be called a smoker's cough. This is a matter of semantics; "second hand smoker's cough" is exactly the same as smoker's cough in cause and prognosis.
1. You may also see smoker's cough referred to as a symptom of chronic obstructive pulmonary disease. COPD is a supercategory which includes chronic bronchitis, emphysema, and other diseases of this sort.