Fix for broken GPIO

migrate commit from d52d21b77c3e120afde1c7c298307ce176e21a94 (branch rpi-3.6.y) to branch rpi-3.10.y. This change necessary for support gpio expanders such as mcp23017,pca953x and etc.