I can't say that I'm familiar with that router, however the steps I recommended for the WBR-2310 generally apply to any wireless router. The possible problem, in your case, is that you need that LAN-port to LAN-port connection from the WHR-G54S on the second floor back to the DSL-2540B modem on the first floor.
The WHR-G54S probably does not support a "wireless repeater" mode on its own, but if it does, that is another configuration option. If it does not, you may be able to get "alternative" firmware that does support that mode. A good place to ask questions about this is the Buffalo forum on DSLReports.com.
Still, repeaters are troublesome and they cut your wireless bandwidth in half. If I had a poor signal on the second floor, I would take a different approach.
1. Reorient the antenna of the WBR-2310 so it is at a slant that favors the upper floors of the house. If the antenna is pointing straight up, then the TX/RX pattern is parallel with the first floor. But if the antenna is pointing towards the walls, then the pattern is parallel to the walls and the signal will be better above and below. The pattern to those rubber-ducky antennas is shaped like a doughnut and the signal extends outward from the sides of the antenna. Keeping all this in mind, try moving that antenna so that it "shines" more toward the part of the house that has the poor signal.
2. Replace the removable antenna on the WBR-2310 with an improved one, such as one from THIS page. The various antennas on that page will let you "shape" your wireless TX/RX area, and you can set the antenna to direct more signal toward the upper or outer reaches of your house.
3. Try replacing the WBR-2310 with the WHR-G54S (same configuration suggested above, no DHCP server, no UPnP, no logging, LAN-to-LAN). The WHR-G54S may (or might not) have a better antenna than the WBR-2310.