Commit c1a99467804767400752a4087d3e96af2759a046
Committed by
Wolfram Sang
1 parent
153369139a
Exists in
master
and in
20 other branches
i2c: mv64xxx: Fix some build warnings
Some functions and variables are only used if the configuration selects HAVE_CLK. Protect them with a corresponding #ifdef CONFIG_HAVE_CLK block to avoid compiler warnings. Signed-off-by: Thierry Reding <treding@nvidia.com> [wsa: added marker to #endif] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff
drivers/i2c/busses/i2c-mv64xxx.c
... | ... | @@ -697,6 +697,7 @@ |
697 | 697 | MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table); |
698 | 698 | |
699 | 699 | #ifdef CONFIG_OF |
700 | +#ifdef CONFIG_HAVE_CLK | |
700 | 701 | static int |
701 | 702 | mv64xxx_calc_freq(const int tclk, const int n, const int m) |
702 | 703 | { |
703 | 704 | |
... | ... | @@ -726,16 +727,12 @@ |
726 | 727 | return false; |
727 | 728 | return true; |
728 | 729 | } |
730 | +#endif /* CONFIG_HAVE_CLK */ | |
729 | 731 | |
730 | 732 | static int |
731 | 733 | mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, |
732 | 734 | struct device *dev) |
733 | 735 | { |
734 | - const struct of_device_id *device; | |
735 | - struct device_node *np = dev->of_node; | |
736 | - u32 bus_freq, tclk; | |
737 | - int rc = 0; | |
738 | - | |
739 | 736 | /* CLK is mandatory when using DT to describe the i2c bus. We |
740 | 737 | * need to know tclk in order to calculate bus clock |
741 | 738 | * factors. |
... | ... | @@ -744,6 +741,11 @@ |
744 | 741 | /* Have OF but no CLK */ |
745 | 742 | return -ENODEV; |
746 | 743 | #else |
744 | + const struct of_device_id *device; | |
745 | + struct device_node *np = dev->of_node; | |
746 | + u32 bus_freq, tclk; | |
747 | + int rc = 0; | |
748 | + | |
747 | 749 | if (IS_ERR(drv_data->clk)) { |
748 | 750 | rc = -ENODEV; |
749 | 751 | goto out; |