As @Lawrence commented, "for the whole weekend" sounds correct, but "for all weekend" does not. This usage of "for" is grammatically "for ". "Two hours" and "the whole weekend" are durations, but I propose that "all weekend" is actually a specific time, not a duration. "All weekend" is a noun describing the location of a chunk of time: Sat + Sun (or Fri ...
It means that he wanted to smoke and he stopped for that purpose.If you use gerund in the sentence you mean that he gave up smoking.
and you can take a close look at " https://dictionary.cambridge.org/tr/dilbilgisi/ingiliz-dilbilgisi/verb-patterns/stop-ing-form-or-to-infinitive "
i hope i could help.Have a good day.