I was wondering if clock from RCC to GPIO peripheral is needed other times than accessing GPIO registers. On STM32F051 datasheet it says for example that current draw when clocked is 9uA/MHz on GPIOA and 12uA/MHz on GPIOB. So it looks like you could save a few microamps by turning the clock off if you don't need to access GPIO registers too often.
For example, you only access GPIO registers during init, like:
I did a quick test on STM32F0Discovery and GPIO pins set as output seemed to retain their state and I was also able to output PWM from a timer to a GPIO pin set as alternater mode after turning clock to GPIO off after initialization.
Is there any pitfalls if you shut off the clock to GPIO when you are not accessing GPIO registers? Will other peripherals be able to use pins as inputs/outputs normally? Will the external interrupts work normally?